-
-
Save wweevv-johndpope/716c42f32e73062e6fd91a1dc8032986 to your computer and use it in GitHub Desktop.
Symfony Messenger | Digitalocean App Platform | Dockerfile | Supervisor
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
FROM composer:2.5 AS build | |
WORKDIR /application | |
ENV APP_ENV=prod | |
COPY . . | |
RUN composer install --no-dev --no-scripts --ignore-platform-reqs --optimize-autoloader | |
FROM php:8.1-cli-bullseye | |
WORKDIR /application | |
RUN apt-get update \ | |
&& DEBIAN_FRONTEND=noninteractive apt-get -y --no-install-recommends install -y \ | |
apt-transport-https \ | |
ca-certificates \ | |
libicu-dev \ | |
libicu-dev \ | |
libpng-dev \ | |
libzip-dev \ | |
software-properties-common \ | |
wget \ | |
zlib1g-dev \ | |
curl \ | |
git \ | |
openssl \ | |
unzip \ | |
supervisor \ | |
&& rm -rf /var/lib/apt/lists/* \ | |
&& rm -rf /etc/cron.*/* | |
RUN docker-php-ext-install -j$(nproc) intl \ | |
&& docker-php-ext-install -j$(nproc) opcache \ | |
&& docker-php-ext-install -j$(nproc) zip \ | |
&& docker-php-ext-install -j$(nproc) pdo_mysql \ | |
&& docker-php-ext-install -j$(nproc) pcntl | |
COPY entrypoint.sh /entrypoint.sh | |
COPY --from=build /application /application | |
RUN chmod +x /entrypoint.sh \ | |
&& mv supervisord.conf /etc/supervisor/supervisord.conf \ | |
&& mv worker.conf /etc/supervisor/conf.d/app.conf \ | |
&& ls -la /etc/supervisor/conf.d | |
RUN APP_ENV=prod APP_DEBUG=0 php bin/console cache:clear | |
ENTRYPOINT ["/entrypoint.sh"] | |
CMD ["supervisord", "-c", "/etc/supervisor/supervisord.conf"] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[unix_http_server] | |
file=/tmp/supervisor.sock | |
chmod=0700 | |
[supervisord] | |
nodaemon=true | |
logfile=/tmp/supervisord.log | |
pidfile=/tmp/supervisord.pid | |
[rpcinterface:supervisor] | |
supervisor.rpcinterface_factory=supervisor.rpcinterface:make_main_rpcinterface | |
[supervisorctl] | |
serverurl=unix:///tmp/supervisor.sock | |
[include] | |
files = /etc/supervisor/conf.d/*.conf |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[program:worker] | |
command=php /application/bin/console messenger:consume async --time-limit=360 --limit=10 --memory-limit=256M | |
autorestart=true | |
stdout_logfile=/dev/fd/1 | |
stdout_logfile_maxbytes=0 | |
redirect_stderr=true |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment