Auto reload localhost when changes in docker compose

  docker, docker-compose, dockerfile, nginx

I need help with docker-compose and my application. When i do something in my local file i have to reload localhost manualy every time. Very often I have errors when I refresh localhost too quickly 🙁

My docker-compose.yml:

services:
 mysql:
  image: mysql:5.7
  ports: ['3306:3306']
php:
 build: ./php
 ports: ['9000:9001']
 links:
  - mysql
 volumes:
  - ${APP_PATH}:/var/www/symfony:cached

nginx:
 build: ./nginx
 ports: ['80:80']
 links:
  - php
 volumes:
  - ./logs/nginx:/var/log/nginx:cached
  - ${APP_PATH}:/var/www/symfony:cached

Dockerfile nginx:

FROM alpine:3.10

RUN apk add --update nginx
RUN rm -rf /var/cache/apk/* && rm -rf /tmp/*

ADD nginx.conf /etc/nginx/
ADD symfony.conf /etc/nginx/conf.d/default.conf
RUN echo "upstream php-upstream { server php:9001; }" > /etc/nginx/conf.d/upstream.conf

RUN adduser -D -g 'www' www 
&& chown -R www:www /var/www

EXPOSE 80

CMD ["nginx"]

Source: Docker Questions

LEAVE A COMMENT