moving to environment variables
This commit is contained in:
13
nginx/Dockerfile
Normal file
13
nginx/Dockerfile
Normal file
@@ -0,0 +1,13 @@
|
||||
FROM nginx:latest
|
||||
|
||||
|
||||
# Copy template config
|
||||
COPY nginx.conf.template /etc/nginx/nginx.conf.template
|
||||
|
||||
# Update package list and install gettext-base
|
||||
RUN apt-get update && apt-get install -y gettext-base
|
||||
|
||||
# Replace variables at build time
|
||||
ENV BACKEND_HOST=backend
|
||||
|
||||
CMD /bin/sh -c "envsubst '\$BACKEND_HOST' < /etc/nginx/nginx.conf.template > /etc/nginx/nginx.conf && nginx -g 'daemon off;'"
|
||||
@@ -38,7 +38,7 @@ http {
|
||||
}
|
||||
|
||||
location /posts/ {
|
||||
proxy_pass http://backend:8080/posts;
|
||||
proxy_pass http://$BACKEND_HOST:8080/posts;
|
||||
proxy_set_header Host $host;
|
||||
proxy_set_header X-Real-IP $remote_addr;
|
||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||
Reference in New Issue
Block a user