Dockerfile: move nginx config templating to run script
This commit is contained in:
+2
-4
@@ -17,10 +17,8 @@ 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 docker/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;'
|
||||
COPY docker/run.sh /usr/local/bin/run.sh
|
||||
CMD run.sh
|
||||
|
||||
ENV PORT 80
|
||||
|
||||
Executable
+9
@@ -0,0 +1,9 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
# Run nginx as root
|
||||
sed -i 's/user nginx.*$//' /etc/nginx/nginx.conf
|
||||
|
||||
# Write selected env vars to nginx config
|
||||
envsubst '$PORT' < /etc/nginx/conf.d/default.conf.template > /etc/nginx/conf.d/default.conf
|
||||
|
||||
exec nginx -g 'daemon off;'
|
||||
Reference in New Issue
Block a user