Last active
November 25, 2020 11:01
-
-
Save vicentimartins/1111459be9ccedf58333fa59bf494b78 to your computer and use it in GitHub Desktop.
Dockerfile
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
### Stage 1: Base PHP ### | |
FROM php:7.4-fpm-alpine as php | |
COPY --from=composer /usr/local/bin /usr/local/bin/ | |
RUN apk add --update \ | |
curl-dev \ | |
libcurl \ | |
libpng \ | |
freetype \ | |
libjpeg-turbo \ | |
freetype-dev \ | |
libpng-dev \ | |
libjpeg-turbo-dev \ | |
libxml2 \ | |
libxml2-dev \ | |
libzip \ | |
libzip-dev \ | |
postgresql-dev \ | |
--allow-untrusted | |
RUN docker-php-ext-install soap \ | |
curl \ | |
gd \ | |
bcmath \ | |
xml \ | |
zip \ | |
pdo \ | |
pdo_pgsql | |
# RUN service php7.4-fpm start | |
## Add configuration files | |
COPY docker/conf/php.ini /etc/php/7.4/fpm/conf.d/40-custom.ini | |
COPY docker/conf/php.ini /etc/php/7.4/cli/conf.d/20-custom.ini | |
######################################################################################################################## | |
### Stage 2: Nginx base ### | |
FROM nginx AS dev | |
## Remove default nginx configs. | |
# RUN rm -f /etc/nginx/conf.d/* | |
# RUN rm -f /etc/nginx/nginx.conf | |
# RUN rm -f /root/.ssh/id_rsa | |
# RUN rm -f /root/.ssh/id_rsa.pub | |
RUN apt-get update | |
## Install packages | |
RUN apt-get install -my \ | |
curl \ | |
cron \ | |
netcat \ | |
git-core \ | |
supervisor \ | |
unzip \ | |
wget \ | |
nano \ | |
vim | |
COPY --from=php /etc/php/ /etc/php/ | |
COPY docker/conf/nginx.conf /etc/nginx/ | |
COPY docker/conf/supervisord.conf /etc/supervisor/conf.d/ | |
COPY docker/vhosts/default.vhost /etc/nginx/conf.d/default.vhost | |
# Converting files to be executed on Windows | |
RUN sed -i -e 's/\r$//' /usr/bin/supervisord | |
RUN sed -i -e 's/\r$//' /etc/ssl/openssl.cnf | |
COPY docker/init/php_conf.sh /home/php_conf.sh | |
RUN sed -i -e 's/\r$//' /home/php_conf.sh | |
RUN chmod +x /home/php_conf.sh | |
WORKDIR '/var/www/' | |
EXPOSE 80 443 9000 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment