fixup
This commit is contained in:
parent
4edc4ccd85
commit
f40a8697bc
|
@ -1,7 +1,12 @@
|
||||||
# Start from the official Nginx image
|
# Start from the official Nginx image
|
||||||
FROM nginx:alpine
|
FROM nginx:alpine
|
||||||
|
|
||||||
# Copy our custom Nginx configuration
|
# Copy our custom Nginx configuration and script
|
||||||
COPY nginx.conf /etc/nginx/nginx.conf
|
COPY nginx.conf /etc/nginx/nginx.conf.template
|
||||||
|
COPY docker-entrypoint.sh /docker-entrypoint.sh
|
||||||
|
|
||||||
|
# Make the script executable
|
||||||
|
RUN chmod +x /docker-entrypoint.sh
|
||||||
|
|
||||||
|
ENTRYPOINT ["/docker-entrypoint.sh"]
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,7 @@
|
||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
# Use envsubst to replace environment variables in nginx.conf.template and output to nginx.conf
|
||||||
|
envsubst '$BACKEND_ADDRESS,$BACKEND_PORT' < /etc/nginx/nginx.conf.template > /etc/nginx/nginx.conf
|
||||||
|
|
||||||
|
# Start nginx in the foreground
|
||||||
|
exec nginx -g 'daemon off;'
|
|
@ -1,10 +1,6 @@
|
||||||
user nginx;
|
user nginx;
|
||||||
worker_processes 1;
|
worker_processes 1;
|
||||||
|
|
||||||
# Load environment variables
|
|
||||||
env BACKEND_ADDRESS;
|
|
||||||
env BACKEND_PORT;
|
|
||||||
|
|
||||||
events {
|
events {
|
||||||
worker_connections 1024;
|
worker_connections 1024;
|
||||||
}
|
}
|
||||||
|
@ -17,7 +13,7 @@ http {
|
||||||
listen 80;
|
listen 80;
|
||||||
|
|
||||||
location / {
|
location / {
|
||||||
# Use the environment variables for the proxy pass
|
# Use the placeholders for the proxy pass (these will be replaced by envsubst)
|
||||||
proxy_pass http://$BACKEND_ADDRESS:$BACKEND_PORT;
|
proxy_pass http://$BACKEND_ADDRESS:$BACKEND_PORT;
|
||||||
proxy_set_header Host $host;
|
proxy_set_header Host $host;
|
||||||
proxy_set_header X-Real-IP $remote_addr;
|
proxy_set_header X-Real-IP $remote_addr;
|
||||||
|
|
Loading…
Reference in New Issue