Skip to content

Commit

Permalink
fix: Migrate from S6-Overlay to Supervisor for process management and…
Browse files Browse the repository at this point in the history
… update entrypoint scripts
  • Loading branch information
MrAnyx committed Jan 4, 2025
1 parent b3e30d2 commit 6677a08
Show file tree
Hide file tree
Showing 6 changed files with 26 additions and 24 deletions.
14 changes: 12 additions & 2 deletions .docker/entrypoint.dev.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,16 @@
#!/bin/bash
set -e

cat /etc/environment \
| sed -e 's/"//g' \
| awk -F= '{key=$1}{value=$2} BEGIN {printf "environment="} NR>1 {printf ","} {printf key"=\42"value"\42"} END {printf "\n"}' \
>> /etc/supervisor/conf.d/supervisord.conf

# Update and start supervisor service
echo "Starting S6-Overlay..."
exec /init
echo "Starting supervisor..."
service supervisor start
supervisorctl reread
supervisorctl update
supervisorctl restart all

exec docker-php-entrypoint "$@"
14 changes: 12 additions & 2 deletions .docker/entrypoint.prod.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,16 @@ set -e
echo "Running database migrations..."
php bin/console doctrine:migrations:migrate --no-interaction --allow-no-migration

cat /etc/environment \
| sed -e 's/"//g' \
| awk -F= '{key=$1}{value=$2} BEGIN {printf "environment="} NR>1 {printf ","} {printf key"=\42"value"\42"} END {printf "\n"}' \
>> /etc/supervisor/conf.d/supervisord.conf

# Update and start supervisor service
echo "Starting S6-Overlay..."
exec /init
echo "Starting supervisor..."
service supervisor start
supervisorctl reread
supervisorctl update
supervisorctl restart all

exec docker-php-entrypoint "$@"
6 changes: 0 additions & 6 deletions .docker/s6/apache/run

This file was deleted.

6 changes: 0 additions & 6 deletions .docker/s6/messenger/run

This file was deleted.

1 change: 0 additions & 1 deletion .docker/supervisord.conf
Original file line number Diff line number Diff line change
Expand Up @@ -35,4 +35,3 @@ stdout_logfile=/dev/stdout
stdout_logfile_maxbytes=0
stderr_logfile=/dev/stderr
stderr_logfile_maxbytes=0
EnvironmentFile=/etc/environment
9 changes: 2 additions & 7 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,12 +1,6 @@
FROM php:8.3.15-apache AS base
RUN apt-get update && apt-get install -y supervisor
WORKDIR /var/www/html
RUN apt-get update
ARG S6_OVERLAY_VERSION=3.2.0.2
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
COPY --chmod=755 ./.docker/s6 /etc/services.d
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
RUN install-php-extensions opcache
Expand All @@ -16,6 +10,7 @@ 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 6677a08

Please sign in to comment.