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

(feat): permitir configurar o memory limit #35

Open
wants to merge 3 commits into
base: php8dot2
Choose a base branch
from
Open
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
16 changes: 8 additions & 8 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,9 @@ ENV \
XDEBUG_VERSION="-3.2.1" \
XDEBUG_REMOTE_PORT=9000 \
PHP_EXTENSION_WDDX=1 \
PHP_OPENSSL=1
PHP_OPENSSL=1 \
PHP_MEMORY_LIMIT="-1" \
PHP_USE_MEMORY_LIMIT_APACHE=true

ENV CONTAINER_STARTED_LOCK=/var/lock/container.starting

Expand Down Expand Up @@ -78,26 +80,24 @@ RUN echo "---> Adding Tini" && \
RUN echo "---> Config sudoers" && \
echo "www-data ALL = ( ALL ) NOPASSWD: ALL" >> /etc/sudoers

COPY --from=composer:latest /usr/bin/composer /usr/bin/composer
COPY --from=composer:latest /usr/bin/composer /usr/local/bin/composer
RUN echo "---> Fix permissions" \
&& chown -R www-data:www-data /var/log/apache2 \
&& mkdir /var/www/.composer && chown -R www-data:www-data /var/www/.composer

COPY configs/ports.conf /etc/apache2/ports.conf
COPY configs/logs.conf /etc/apache2/conf-enabled/logs.conf
COPY configs/php-errors.ini /usr/local/etc/php/conf.d/php-errors.ini
COPY apache-run.sh /usr/bin/apache-run
COPY ./bin /usr/bin/
COPY configs/php-memory-limit.ini /usr/local/etc/php/conf.d/php-memory-limit.ini
COPY ./bin /usr/local/bin/

RUN chmod a+x \
/usr/bin/apache-run \
/usr/bin/xdebug-set-mode \
/usr/bin/post-startup-hook
/usr/local/bin/*

USER www-data

WORKDIR "/var/www/html"

EXPOSE 8080 9001

CMD ["/tini", "--", "/usr/bin/apache-run"]
CMD ["apache-run"]
4 changes: 4 additions & 0 deletions apache-run.sh → bin/apache-run
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@ fi
sudo -E newrelic-setup
sudo -E opcache-setup

if [[ ${PHP_USE_MEMORY_LIMIT_APACHE} == true ]]; then
export PHP_MEMORY_LIMIT=128M
fi

if [[ ${SESSION_HANDLER} == true ]]; then
sudo rm -f /usr/local/etc/php/conf.d/session-handler.ini
echo "session.save_handler = ${SESSION_HANDLER_NAME}" | sudo tee -a /usr/local/etc/php/conf.d/session-handler.ini
Expand Down
1 change: 1 addition & 0 deletions configs/php-memory-limit.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
memory_limit = ${PHP_MEMORY_LIMIT}