Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: dockerfile optimization #11

Merged
merged 1 commit into from
Dec 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 7 additions & 13 deletions .docker/Dockerfile.apache
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@ RUN apt-get update && apt-get install --no-install-recommends -y \
git \
mariadb-client supervisor cron && \
apt-get clean && \
rm -rf /var/lib/apt/lists/*
rm -rf /var/lib/apt/lists/* && \
rm /etc/cron.daily/*

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

RUN rm /etc/cron.daily/*

# Setting PHP properties
ENV PHP_INI_VALUE_DATE_TIMEZONE='UTC' \
PHP_INI_VALUE_MEMORY_LIMIT=512M \
PHP_INI_VALUE_UPLOAD_MAX_FILESIZE=512M \
PHP_INI_VALUE_POST_MAX_FILESIZE=512M \
PHP_INI_VALUE_MAX_EXECUTION_TIME=300

COPY ./scripts/php.ini /usr/local/etc/php/php.ini
COPY ./scripts/xdebug.ini /usr/local/etc/php/conf.d/xdebug.ini

ENV APACHE_DOCUMENT_ROOT=/var/www/html/docroot

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

COPY ./scripts/docker-entrypoint.sh /entrypoint.sh
COPY ./scripts/entrypoint_mautic_web.sh /entrypoint_mautic_web.sh
COPY ./scripts/entrypoint_mautic_cron.sh /entrypoint_mautic_cron.sh
COPY ./scripts/entrypoint_mautic_worker.sh /entrypoint_mautic_worker.sh
COPY ./config/php.ini /usr/local/etc/php/php.ini
COPY ./config/xdebug.ini /usr/local/etc/php/conf.d/xdebug.ini
COPY ./config/supervisord.conf /etc/supervisor/conf.d/supervisord.conf
COPY ./scripts/*.sh /

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

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

COPY ./scripts/supervisord.conf /etc/supervisor/conf.d/supervisord.conf

# Define Mautic volumes to persist data
VOLUME /var/www/html

Expand Down
20 changes: 7 additions & 13 deletions .docker/Dockerfile.fpm
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@ RUN apt-get update && apt-get install --no-install-recommends -y \
git \
mariadb-client supervisor cron && \
apt-get clean && \
rm -rf /var/lib/apt/lists/*
rm -rf /var/lib/apt/lists/* && \
rm /etc/cron.daily/*

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

RUN rm /etc/cron.daily/*

# Setting PHP properties
ENV PHP_INI_VALUE_DATE_TIMEZONE='UTC' \
PHP_INI_VALUE_MEMORY_LIMIT=512M \
PHP_INI_VALUE_UPLOAD_MAX_FILESIZE=512M \
PHP_INI_VALUE_POST_MAX_FILESIZE=512M \
PHP_INI_VALUE_MAX_EXECUTION_TIME=300

COPY ./scripts/php.ini /usr/local/etc/php/php.ini
COPY ./scripts/xdebug.ini /usr/local/etc/php/conf.d/xdebug.ini

COPY ./scripts/docker-entrypoint.sh /entrypoint.sh
COPY ./scripts/entrypoint_mautic_web.sh /entrypoint_mautic_web.sh
COPY ./scripts/entrypoint_mautic_cron.sh /entrypoint_mautic_cron.sh
COPY ./scripts/entrypoint_mautic_worker.sh /entrypoint_mautic_worker.sh
COPY ./config/php.ini /usr/local/etc/php/php.ini
COPY ./config/xdebug.ini /usr/local/etc/php/conf.d/xdebug.ini
COPY ./config/supervisord.conf /etc/supervisor/conf.d/supervisord.conf
COPY ./scripts/*.sh /

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

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

COPY ./scripts/supervisord.conf /etc/supervisor/conf.d/supervisord.conf

# Define Mautic volumes to persist data
VOLUME /var/www/html

Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
Loading