Docker production ready php-fpm and nginx configuration Docker production ready php-fpm and nginx configuration nginx nginx

Docker production ready php-fpm and nginx configuration


I solve the problem by making a shared volume with the docker-compose file:

version: '3'volumes: share_place:services: php:  image: php:5-fpm-alpine  ports:   - 9000:9000  volumes:   - share_place:/var/www/app nginx:  image: nginx:alpine  ports:   - 3000:80  volumes:   - share_place:/var/www/app

This will create a volume share_place that will share the data between the two container.


At this time I use smth like:

Dockerfile:

FROM php:fpmCOPY . /var/www/app/WORKDIR /var/www/app/RUN composer installEXPOSE 9000VOLUME /var/www/app/web

Dockerfile.nginx

FROM nginxCOPY default /etc/nginx/default

docker-compose.yml

app:  build:    context: .web:  build:    context: .    dockerfile: Dockerfile.nginx  volumes_from: app  

But in few days on 17.05 release we can do in one Dockerfile smth like:

FROM php:cli AS builderCOPY . /var/www/app/WORKDIR /var/www/app/RUN composer install && bin/console assets:dumpFROM php:fpm AS appCOPY --from=builder /var/www/app/src /var/www/app/vendor /var/www/app/COPY --from=builder /var/www/app/web/app.php /var/www/app/vendo /var/www/app/web/FROM nginx AS webCOPY default /etc/nginx/defaultCOPY --from=builder /var/www/app/web /var/www/app/web