Skip to content

Commit 014f706

Browse files
authored
Merge pull request #11 from LibreCodeCoop/refactor/dockerfile-optimization
refactor: dockerfile optimization
2 parents 1fabf8c + f8aabb2 commit 014f706

File tree

5 files changed

+14
-26
lines changed

5 files changed

+14
-26
lines changed

.docker/Dockerfile.apache

Lines changed: 7 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,8 @@ RUN apt-get update && apt-get install --no-install-recommends -y \
88
git \
99
mariadb-client supervisor cron && \
1010
apt-get clean && \
11-
rm -rf /var/lib/apt/lists/*
11+
rm -rf /var/lib/apt/lists/* && \
12+
rm /etc/cron.daily/*
1213

1314
# Install PHP extensions
1415
ADD https://github.com/mlocati/docker-php-extension-installer/releases/latest/download/install-php-extensions /usr/local/bin/
@@ -30,31 +31,26 @@ RUN chmod uga+x /usr/local/bin/install-php-extensions && sync \
3031
zip \
3132
xdebug
3233

33-
RUN rm /etc/cron.daily/*
34-
3534
# Setting PHP properties
3635
ENV PHP_INI_VALUE_DATE_TIMEZONE='UTC' \
3736
PHP_INI_VALUE_MEMORY_LIMIT=512M \
3837
PHP_INI_VALUE_UPLOAD_MAX_FILESIZE=512M \
3938
PHP_INI_VALUE_POST_MAX_FILESIZE=512M \
4039
PHP_INI_VALUE_MAX_EXECUTION_TIME=300
4140

42-
COPY ./scripts/php.ini /usr/local/etc/php/php.ini
43-
COPY ./scripts/xdebug.ini /usr/local/etc/php/conf.d/xdebug.ini
44-
4541
ENV APACHE_DOCUMENT_ROOT=/var/www/html/docroot
4642

4743
RUN sed -ri -e "s!/var/www/html!${APACHE_DOCUMENT_ROOT}!g" /etc/apache2/sites-available/*.conf && \
4844
sed -ri -e "s!/var/www/!${APACHE_DOCUMENT_ROOT}!g" /etc/apache2/apache2.conf /etc/apache2/conf-available/*.conf && \
4945
a2enmod rewrite
5046

51-
COPY ./scripts/docker-entrypoint.sh /entrypoint.sh
52-
COPY ./scripts/entrypoint_mautic_web.sh /entrypoint_mautic_web.sh
53-
COPY ./scripts/entrypoint_mautic_cron.sh /entrypoint_mautic_cron.sh
54-
COPY ./scripts/entrypoint_mautic_worker.sh /entrypoint_mautic_worker.sh
47+
COPY ./config/php.ini /usr/local/etc/php/php.ini
48+
COPY ./config/xdebug.ini /usr/local/etc/php/conf.d/xdebug.ini
49+
COPY ./config/supervisord.conf /etc/supervisor/conf.d/supervisord.conf
50+
COPY ./scripts/*.sh /
5551

5652
# Apply necessary permissions
57-
RUN ["chmod", "+x", "/entrypoint.sh", "/entrypoint_mautic_web.sh", "/entrypoint_mautic_cron.sh", "/entrypoint_mautic_worker.sh"]
53+
RUN ["chmod", "+x", "/entrypoint*.sh"]
5854

5955
# Setting worker env vars
6056
ENV DOCKER_MAUTIC_WORKERS_CONSUME_EMAIL=2 \
@@ -76,8 +72,6 @@ RUN mkdir -p /usr/local/nvm && \
7672
nvm alias default $NODE_VERSION && \
7773
nvm use default
7874

79-
COPY ./scripts/supervisord.conf /etc/supervisor/conf.d/supervisord.conf
80-
8175
# Define Mautic volumes to persist data
8276
VOLUME /var/www/html
8377

.docker/Dockerfile.fpm

Lines changed: 7 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,8 @@ RUN apt-get update && apt-get install --no-install-recommends -y \
88
git \
99
mariadb-client supervisor cron && \
1010
apt-get clean && \
11-
rm -rf /var/lib/apt/lists/*
11+
rm -rf /var/lib/apt/lists/* && \
12+
rm /etc/cron.daily/*
1213

1314
# Install PHP extensions
1415
ADD https://github.com/mlocati/docker-php-extension-installer/releases/latest/download/install-php-extensions /usr/local/bin/
@@ -30,25 +31,20 @@ RUN chmod uga+x /usr/local/bin/install-php-extensions && sync \
3031
zip \
3132
xdebug
3233

33-
RUN rm /etc/cron.daily/*
34-
3534
# Setting PHP properties
3635
ENV PHP_INI_VALUE_DATE_TIMEZONE='UTC' \
3736
PHP_INI_VALUE_MEMORY_LIMIT=512M \
3837
PHP_INI_VALUE_UPLOAD_MAX_FILESIZE=512M \
3938
PHP_INI_VALUE_POST_MAX_FILESIZE=512M \
4039
PHP_INI_VALUE_MAX_EXECUTION_TIME=300
4140

42-
COPY ./scripts/php.ini /usr/local/etc/php/php.ini
43-
COPY ./scripts/xdebug.ini /usr/local/etc/php/conf.d/xdebug.ini
44-
45-
COPY ./scripts/docker-entrypoint.sh /entrypoint.sh
46-
COPY ./scripts/entrypoint_mautic_web.sh /entrypoint_mautic_web.sh
47-
COPY ./scripts/entrypoint_mautic_cron.sh /entrypoint_mautic_cron.sh
48-
COPY ./scripts/entrypoint_mautic_worker.sh /entrypoint_mautic_worker.sh
41+
COPY ./config/php.ini /usr/local/etc/php/php.ini
42+
COPY ./config/xdebug.ini /usr/local/etc/php/conf.d/xdebug.ini
43+
COPY ./config/supervisord.conf /etc/supervisor/conf.d/supervisord.conf
44+
COPY ./scripts/*.sh /
4945

5046
# Apply necessary permissions
51-
RUN ["chmod", "+x", "/entrypoint.sh", "/entrypoint_mautic_web.sh", "/entrypoint_mautic_cron.sh", "/entrypoint_mautic_worker.sh"]
47+
RUN ["chmod", "+x", "/entrypoint*.sh"]
5248

5349
# Setting worker env vars
5450
ENV DOCKER_MAUTIC_WORKERS_CONSUME_EMAIL=2 \
@@ -70,8 +66,6 @@ RUN mkdir -p /usr/local/nvm && \
7066
nvm alias default $NODE_VERSION && \
7167
nvm use default
7268

73-
COPY ./scripts/supervisord.conf /etc/supervisor/conf.d/supervisord.conf
74-
7569
# Define Mautic volumes to persist data
7670
VOLUME /var/www/html
7771

File renamed without changes.
File renamed without changes.
File renamed without changes.

0 commit comments

Comments
 (0)