Skip to content

Commit

Permalink
fix: improve the build by splitting downloading and creation of the i…
Browse files Browse the repository at this point in the history
…mage
  • Loading branch information
749 committed Nov 18, 2024
1 parent b20f643 commit de8cc5e
Showing 1 changed file with 22 additions and 14 deletions.
36 changes: 22 additions & 14 deletions build/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -11,25 +11,20 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <https://www.gnu.org/licenses/>.

FROM php:8-fpm-alpine

LABEL org.opencontainers.image.authors="Jan Giesenberg <[email protected]>"

EXPOSE 9000

RUN apk add --no-cache rsync freetype-dev libpng-dev jpeg-dev unzip sudo bash gettext \
&& docker-php-ext-configure gd --with-freetype --with-jpeg \
&& docker-php-ext-install -j$(nproc) gd opcache mysqli pdo pdo_mysql \
&& rm -rf /usr/src/php/
FROM php:8-fpm-alpine AS downloader

ARG MODX_VERSION 2.8.7
ENV MODX_VERSION ${MODX_VERSION}

WORKDIR /

RUN apk add --no-cache unzip

# upstream tarballs include ./modx-${MODX_VERSION}/
RUN cd / \
&& echo ${MODX_VERSION} \
&& curl -o modx.zip -SL http://modx.com/download/direct/modx-${MODX_VERSION}-pl.zip \
&& unzip -q modx.zip -d /usr/src \
RUN echo ${MODX_VERSION} \
&& curl -o modx.zip -SL https://modx.com/download/direct/modx-${MODX_VERSION}-pl.zip

RUN unzip -oaq modx.zip -d /usr/src \
&& rm -rf /modx \
&& mkdir -p /modx /usr/src/modx \
&& mv /usr/src/modx-${MODX_VERSION}-pl/ /modx/public \
Expand All @@ -39,6 +34,19 @@ RUN cd / \
&& rm modx.zip \
&& chown -R www-data:www-data /modx

FROM php:8-fpm-alpine

LABEL org.opencontainers.image.authors="Jan Giesenberg <[email protected]>"

EXPOSE 9000

RUN apk add --no-cache rsync freetype-dev libpng-dev jpeg-dev sudo bash gettext \
&& docker-php-ext-configure gd --with-freetype --with-jpeg \
&& docker-php-ext-install -j$(nproc) gd opcache mysqli pdo pdo_mysql \
&& rm -rf /usr/src/php/

COPY --from=downloader --chown=www-data /usr/src/modx /usr/src/modx
COPY --from=downloader --chown=www-data /modx /modx
COPY --chown=www-data files/docker-entrypoint.sh /entrypoint.sh
COPY --chown=www-data:www-data files/docker-entrypoint /docker-entrypoint
COPY files/php-config/ /usr/local/etc/php/conf.d/
Expand Down

0 comments on commit de8cc5e

Please sign in to comment.