Last active
July 12, 2022 16:36
-
-
Save nian88/7aab6cf1b974b9b27423504ff5d7c5a1 to your computer and use it in GitHub Desktop.
implementasi supervisor laravel dan apache di dcoker
This file contains 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 php:7.4-apache | |
# Install composer | |
COPY --from=composer /usr/bin/composer /usr/bin/composer | |
# Install required composer extensions | |
RUN apt-get update && apt-get install -qqy libzip-dev libpq-dev unzip --no-install-recommends | |
RUN apt-get install supervisor -qqy | |
RUN docker-php-ext-install zip | |
RUN docker-php-ext-install mysqli pdo pdo_mysql | |
# Make supervisor log directory | |
RUN mkdir -p /var/log/supervisor | |
# Copy App Files | |
COPY . /var/www/html/ | |
# Install required app files | |
RUN composer install | |
RUN cp .env.example .env | |
RUN chmod -R 777 /var/www/html/storage | |
RUN php artisan key:generate | |
# Install required app files | |
RUN composer install | |
# Enable mod_rewrite | |
RUN a2enmod rewrite | |
# Ubah konfigurasi document_root ke public Laravel | |
ENV APACHE_DOCUMENT_ROOT /var/www/html/public | |
RUN sed -ri -e 's!/var/www/html!${APACHE_DOCUMENT_ROOT}!g' /etc/apache2/sites-available/*.conf | |
RUN sed -ri -e 's!/var/www/!${APACHE_DOCUMENT_ROOT}!g' /etc/apache2/apache2.conf /etc/apache2/conf-available/*.conf | |
# Copy local supervisord.conf to the conf.d directory | |
COPY --chown=root:root supervisord.conf /etc/supervisor/conf.d/supervisord.conf | |
# Start supervisord | |
CMD ["/usr/bin/supervisord", "-c", "/etc/supervisor/supervisord.conf"] |
This file contains 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
[supervisord] | |
logfile=/dev/null ; main log file; default $CWD/supervisord.log | |
logfile_maxbytes=0 ; max main logfile bytes b4 rotation; default 50MB | |
logfile_backups=10 ; # of main logfile backups; 0 means none, default 10 | |
loglevel=info ; log level; default info; others: debug,warn,trace | |
pidfile=/run/supervisord.pid ; supervisord pidfile; default supervisord.pid | |
nodaemon=true ; start in foreground if true; default false | |
minfds=1024 ; min. avail startup file descriptors; default 1024 | |
minprocs=200 ; min. avail process descriptors;default 200 | |
[program:worker] | |
directory=/var/www/html | |
process_name=%(program_name)s_%(process_num)02d | |
command=php artisan queue:work --sleep=3 --tries=3 | |
autostart=true | |
autorestart=true | |
stopasgroup=true | |
killasgroup=true | |
user=root | |
numprocs=2 | |
redirect_stderr=true | |
stdout_logfile = /dev/fd/1 | |
stdout_logfile_maxbytes=0 | |
stderr_logfile = /dev/fd/2 | |
stderr_logfile_maxbytes=0 | |
redirect_stderr=true | |
stopwaitsecs=3600 | |
priority = 6 | |
[program:apache2] | |
command=/usr/sbin/apache2ctl -DFOREGROUND | |
killasgroup=true | |
stopasgroup=true | |
stdout_logfile = /dev/fd/1 | |
stdout_logfile_maxbytes=0 | |
stderr_logfile = /dev/fd/2 | |
stderr_logfile_maxbytes=0 | |
redirect_stderr=true | |
autostart=true | |
autorestart=true | |
user=root | |
priority = 1 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment