Created
October 27, 2016 09:04
-
-
Save chrisedington/756da805b547750098dee445a545ecea to your computer and use it in GitHub Desktop.
This file contains hidden or 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
# build from the official Nginx image | |
FROM nginx | |
# install essential Linux packages | |
RUN apt-get update -qq && apt-get -y install apache2-utils | |
# establish where Nginx should look for files | |
ENV RAILS_ROOT /var/www/myapp | |
# Set our working directory inside the image | |
WORKDIR $RAILS_ROOT | |
# create log directory | |
RUN mkdir log | |
# copy over static assets | |
COPY public public/ | |
# copy our Nginx config template | |
COPY config/containers/nginx.conf /tmp/myapp.nginx | |
# substitute variable references in the Nginx config template for real values from the environment | |
# put the final config in its place | |
RUN envsubst '$RAILS_ROOT' < /tmp/myapp.nginx > /etc/nginx/conf.d/default.conf | |
# Use the "exec" form of CMD so Nginx shuts down gracefully on SIGTERM (i.e. `docker stop`) | |
CMD [ "nginx", "-g", "daemon off;" ] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment