Skip to content

Commit 833fbd6

Browse files
committed
Target host override from env
1 parent 482abab commit 833fbd6

File tree

3 files changed

+5
-4
lines changed

3 files changed

+5
-4
lines changed

Dockerfile

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
FROM nginx:alpine
22

3-
ENV HTPASSWD='foo:$apr1$odHl5EJN$KbxMfo86Qdve2FH4owePn.' \
4-
FORWARD_PORT=80
3+
ENV HTPASSWD='foo:$apr1$odHl5EJN$KbxMfo86Qdve2FH4owePn.'
4+
ENV FORWARD_PORT=80
5+
ENV TARGET_HOST=web
56

67
WORKDIR /opt
78

auth.conf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ server {
55
auth_basic "Restricted";
66
auth_basic_user_file auth.htpasswd;
77

8-
proxy_pass http://web:${FORWARD_PORT};
8+
proxy_pass "http://${TARGET_HOST}:${FORWARD_PORT}";
99
proxy_read_timeout 900;
1010
}
1111
}

launch.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#!/bin/sh
22

3-
envsubst < auth.conf > /etc/nginx/conf.d/auth.conf
3+
envsubst < auth.conf > /etc/nginx/conf.d/default.conf
44
envsubst < auth.htpasswd > /etc/nginx/auth.htpasswd
55

66
nginx -g "daemon off;"

0 commit comments

Comments
 (0)