Skip to content

Commit 3d9028d

Browse files
authored
Optimize Dockerfile layers and clean up config (#4)
1 parent 96c8b62 commit 3d9028d

File tree

2 files changed

+9
-21
lines changed

2 files changed

+9
-21
lines changed

Dockerfile

Lines changed: 9 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -58,16 +58,14 @@ RUN set -eux; \
5858
COPY --from=composer:2 /usr/bin/composer /usr/bin/composer
5959

6060
# Set up app dir and ownership
61-
RUN usermod -u 1000 www-data && groupmod -g 1000 www-data
62-
RUN mkdir -p /etc/caddy /data/caddy /var/www/html /var/www/.composer /etc/php \
61+
RUN usermod -u 1000 www-data && groupmod -g 1000 www-data \
62+
&& mkdir -p /etc/caddy /data/caddy /var/www/html /var/www/.composer /etc/php \
6363
&& chown -R www-data:www-data /var/www /data /etc/caddy \
6464
&& chown root:root /etc/php
6565

66+
# Copy configuration files and entrypoint
6667
COPY --chown=www-data:www-data common/Caddyfile.template /etc/caddy/Caddyfile.template
67-
COPY common/entrypoint-base.sh /usr/local/bin/entrypoint.sh
68-
RUN chmod +x /usr/local/bin/entrypoint.sh
69-
70-
# Copy PHP configuration from common
68+
COPY --chmod=755 common/entrypoint-base.sh /usr/local/bin/entrypoint.sh
7169
COPY common/conf/app.ini /usr/local/etc/php/conf.d/zz-app.ini
7270
COPY common/conf/opcache.ini /usr/local/etc/php/conf.d/zz-opcache.ini
7371

@@ -77,10 +75,7 @@ ENV CADDY_LOG_OUTPUT=stdout \
7775

7876
WORKDIR /var/www/html
7977

80-
EXPOSE 80
81-
EXPOSE 443
82-
EXPOSE 443/udp
83-
EXPOSE 2019
78+
EXPOSE 80 443 443/udp 2019
8479

8580
ENTRYPOINT ["/usr/local/bin/entrypoint.sh"]
8681

@@ -92,21 +87,17 @@ FROM base AS dev
9287
RUN apt-get update && apt-get install -y --no-install-recommends \
9388
git \
9489
mkcert \
95-
&& apt-get clean && rm -rf /var/lib/apt/lists/*
96-
97-
RUN install-php-extensions xdebug
98-
99-
RUN curl -L -o /usr/local/bin/mhsendmail \
90+
&& apt-get clean && rm -rf /var/lib/apt/lists/* \
91+
&& install-php-extensions xdebug \
92+
&& curl -L -o /usr/local/bin/mhsendmail \
10093
https://github.com/mailhog/mhsendmail/releases/download/v0.2.0/mhsendmail_linux_amd64 \
10194
&& chmod +x /usr/local/bin/mhsendmail
10295

10396
# Copy PHP dev configuration from common
10497
COPY common/conf/mail.ini /usr/local/etc/php/conf.d/zz-mail.ini
10598
COPY common/conf/xdebug.ini /usr/local/etc/php/conf.d/zz-xdebug.ini
10699
COPY common/conf/disable-opcache.ini /usr/local/etc/php/conf.d/zz-opcache.ini
107-
108-
COPY common/entrypoint-dev.sh /usr/local/bin/entrypoint.sh
109-
RUN chmod +x /usr/local/bin/entrypoint.sh
100+
COPY --chmod=755 common/entrypoint-dev.sh /usr/local/bin/entrypoint.sh
110101

111102
ENV SENDMAIL_PATH=/usr/local/bin/mhsendmail \
112103
MAGENTO_RUN_MODE=developer \

common/conf/disable-opcache.ini

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,3 @@
11
; Disable OPcache for development
22
opcache.enable=0
33
opcache.enable_cli=0
4-
; optionally harden: disable validating and remote config
5-
opcache.validate_timestamps=0
6-
opcache.restrict_api=0

0 commit comments

Comments
 (0)