From abe9aab7f95b779dacfeba6ee96ef69c7afca177 Mon Sep 17 00:00:00 2001 From: Adam Laiacano Date: Sat, 21 Mar 2020 20:43:55 -0400 Subject: [PATCH] add heroku deployment steps --- Dockerfile | 7 +++++++ default.conf.template | 8 ++++++++ 2 files changed, 15 insertions(+) create mode 100644 default.conf.template diff --git a/Dockerfile b/Dockerfile index 39d51a35f2..3220e46f5f 100644 --- a/Dockerfile +++ b/Dockerfile @@ -15,3 +15,10 @@ RUN yarn build FROM nginx:mainline COPY --from=builder /app/packages/app/build /usr/share/nginx/html + +# Run nginx as root +RUN sed -i 's/user nginx.*$//' /etc/nginx/nginx.conf + +# Copy in the nginx conf template and replace "$PORT" with the environment variable set by heroku +COPY default.conf.template /etc/nginx/conf.d/default.conf.template +CMD /bin/bash -c "envsubst '\$PORT' < /etc/nginx/conf.d/default.conf.template > /etc/nginx/conf.d/default.conf" && nginx -g 'daemon off;' diff --git a/default.conf.template b/default.conf.template new file mode 100644 index 0000000000..9d9ff7f3e2 --- /dev/null +++ b/default.conf.template @@ -0,0 +1,8 @@ +server { + listen $PORT default_server; + + location / { + root /usr/share/nginx/html; + index index.html; + } +} \ No newline at end of file