Dockerfile-nginx 770 B

1234567891011121314151617181920212223242526
  1. # build from the official Nginx image
  2. FROM nginx
  3. # install essential Linux packages
  4. RUN apt-get update -qq && apt-get -y install apache2-utils
  5. # establish where Nginx should look for files
  6. ENV RAILS_ROOT /app
  7. WORKDIR /app
  8. # create log directory
  9. RUN mkdir -p log
  10. # copy over static assets
  11. COPY public public/
  12. # copy our Nginx config template
  13. COPY config/containers/nginx.conf /tmp/docker_example.nginx
  14. # substitute variable references in the Nginx config template for real values from the environment
  15. # put the final config in its place
  16. RUN envsubst '$RAILS_ROOT' < /tmp/docker_example.nginx > /etc/nginx/conf.d/default.conf
  17. # Use the "exec" form of CMD so Nginx shuts down gracefully on SIGTERM (i.e. `docker stop`)
  18. CMD [ "nginx", "-g", "daemon off;" ]
  19. EXPOSE 80