Created
November 13, 2021 13:44
-
-
Save kundancool/62cc3bd114f24c503362f28ab13650cf to your computer and use it in GitHub Desktop.
laravel-php7.4-fpm-alpine
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
# Base Image | |
FROM php:7.4-fpm-alpine | |
# Update system packages | |
RUN apk update && apk upgrade | |
# Install required pacjages | |
RUN apk add --no-cache nano vim nginx composer supervisor npm git htop \ | |
bzip2-dev zlib-dev libpng icu-dev libxml2-dev \ | |
freetype libpng libjpeg-turbo freetype-dev libpng-dev libjpeg-turbo-dev gettext-dev \ | |
python3 py3-pip \ | |
&& pip3 install --upgrade pip \ | |
&& pip3 install awscli \ | |
&& rm -rf /var/cache/apk/* | |
RUN aws --version | |
# Install PHP extensions | |
RUN docker-php-ext-install bcmath bz2 calendar exif gd gettext intl simplexml sockets dba pdo_mysql | |
# Configure directories and configurations | |
WORKDIR /var/www/html | |
RUN mkdir -p /etc/nginx /etc/nginx/sites-available /etc/nginx/sites-enabled /run/nginx | |
RUN ln -s /etc/nginx/sites-available/default.conf /etc/nginx/sites-enabled/default.conf | |
ADD ./nginx/default.conf /etc/nginx/http.d/ | |
RUN sed -i 's/#include \/etc\/nginx\/conf.d/include \/etc\/nginx\/conf.d/g' /etc/nginx/nginx.conf | |
# CONFIGURE: /etc/supervisord.conf | |
RUN sed -i 's/;chmod=0777/chmod=0777/g' /etc/supervisord.conf && \ | |
sed -i 's/;chown=nobody:nogroup/chown=nobody:nogroup/g' /etc/supervisord.conf && \ | |
sed -i 's/;logfile_maxbytes=50MB/logfile_maxbytes=50MB/g' /etc/supervisord.conf && \ | |
sed -i 's/;logfile_backups=10/logfile_backups=10/g' /etc/supervisord.conf && \ | |
sed -i 's/;loglevel=info/loglevel=info/g' /etc/supervisord.conf && \ | |
sed -i 's/;pidfile=\/run\/supervisord.pid/pidfile=\/run\/supervisord.pid/g' /etc/supervisord.conf && \ | |
sed -i 's/;nodaemon=false/nodaemon=true/g' /etc/supervisord.conf && \ | |
sed -i 's/;umask=022/umask=022/g' /etc/supervisord.conf && \ | |
sed -i 's/;identifier=supervisor/identifier=supervisor/g' /etc/supervisord.conf | |
RUN mkdir -p /etc/supervisor.d | |
# nginx supervisord Config | |
RUN echo $'[supervisord] \n\ | |
nodaemon=true \n\ | |
[program:nginx] \n\ | |
command=/usr/sbin/nginx -g \'daemon off;\' \n\ | |
stdout_logfile=/dev/fd/1 \n\ | |
stdout_logfile_maxbytes=0MB \n\ | |
stderr_logfile_maxbytes = 0 \n\ | |
stderr_logfile=/dev/fd/2 \n\ | |
redirect_stderr=true \n\ | |
autorestart=false \n\ | |
startretries=0 \n\ | |
exitcodes=0 ' >> /etc/supervisor.d/nginx.ini | |
# php-fpm7 | |
RUN echo $'[supervisord] \n\ | |
nodaemon=true \n\ | |
[program:php-fpm] \n\ | |
command=php-fpm -y /usr/local/etc/php-fpm.conf -R \n\ | |
stdout_logfile=/dev/fd/1 \n\ | |
stdout_logfile_maxbytes=0MB \n\ | |
stderr_logfile_maxbytes=0 \n\ | |
stderr_logfile=/dev/fd/2 \n\ | |
redirect_stderr=true \n\ | |
autorestart=false \n\ | |
startretries=0 \n\ | |
exitcodes=0 ' >> /etc/supervisor.d/php-fpm.ini | |
EXPOSE 80 | |
ENTRYPOINT ["supervisord", "--nodaemon", "--configuration", "/etc/supervisord.conf"] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment