Skip to content

Commit

Permalink
fix: Replace supervisor with S6-Overlay for process management in ent…
Browse files Browse the repository at this point in the history
…rypoint scripts and Dockerfile
  • Loading branch information
MrAnyx committed Jan 3, 2025
1 parent 5f977c8 commit f2aa4ef
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 16 deletions.
9 changes: 2 additions & 7 deletions .docker/entrypoint.dev.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,5 @@
set -e

# Update and start supervisor service
echo "Starting supervisor..."
service supervisor start
supervisorctl reread
supervisorctl update
supervisorctl restart all

exec docker-php-entrypoint "$@"
echo "Starting S6-Overlay..."
exec /init
9 changes: 2 additions & 7 deletions .docker/entrypoint.prod.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,5 @@ echo "Running database migrations..."
php bin/console doctrine:migrations:migrate --no-interaction --allow-no-migration

# Update and start supervisor service
echo "Starting supervisor..."
service supervisor start
supervisorctl reread
supervisorctl update
supervisorctl restart all

exec docker-php-entrypoint "$@"
echo "Starting S6-Overlay..."
exec /init
6 changes: 6 additions & 0 deletions .docker/s6/apache/run
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#!/usr/bin/with-contenv sh
set -e

echo "Starting apache2"
exec apache2-foreground
echo "apache2 has been started"
6 changes: 6 additions & 0 deletions .docker/s6/messenger/run
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#!/usr/bin/with-contenv sh
set -e

echo "Starting messenger:consume async"
php /var/www/html/bin/console messenger:consume async --time-limit=3600
echo "messenger:consume async has started"
8 changes: 6 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
FROM php:8.3.15-apache AS base
RUN apt-get update && apt-get install -y supervisor
RUN apt-get update
ARG S6_OVERLAY_VERSION=3.2.0.3
ADD https://github.com/just-containers/s6-overlay/releases/download/v${S6_OVERLAY_VERSION}/s6-overlay-noarch.tar.xz /tmp
RUN tar -C / -Jxpf /tmp/s6-overlay-noarch.tar.xz
ADD https://github.com/just-containers/s6-overlay/releases/download/v${S6_OVERLAY_VERSION}/s6-overlay-x86_64.tar.xz /tmp
RUN tar -C / -Jxpf /tmp/s6-overlay-x86_64.tar.xz
WORKDIR /var/www/html
ADD --chmod=0755 https://github.com/mlocati/docker-php-extension-installer/releases/latest/download/install-php-extensions /usr/local/bin/
RUN install-php-extensions intl
Expand All @@ -10,7 +15,6 @@ RUN install-php-extensions @composer
ENV COMPOSER_ALLOW_SUPERUSER=1
COPY ./.docker/apache/apache.conf /etc/apache2/sites-available/000-default.conf
RUN a2enmod rewrite
COPY ./.docker/supervisord.conf /etc/supervisor/conf.d/supervisord.conf
ENTRYPOINT [ "/usr/local/bin/entrypoint.sh" ]

FROM base AS dev
Expand Down

0 comments on commit f2aa4ef

Please sign in to comment.