-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Configure resolver, move scripts from Dockerfile to standalone files
- Loading branch information
Showing
3 changed files
with
6 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,14 @@ | ||
FROM nginx | ||
|
||
ENV REST_API_READ_HOSTNAME=localhost | ||
ENV REST_API_READ_HOSTNAME=host.docker.internal | ||
ENV REST_API_READ_PORT=8081 | ||
ENV REST_API_WRITE_HOSTNAME=localhost | ||
ENV REST_API_WRITE_HOSTNAME=host.docker.internal | ||
ENV REST_API_WRITE_PORT=8082 | ||
|
||
COPY upstream.location.template /etc/nginx/ | ||
COPY --chmod=0777 entrypoint/*.sh /docker-entrypoint.d/ | ||
|
||
RUN perl -0pe 's/root\s+\/usr\/share\/nginx\/html;\s+index\s+index\.html\s+index\.htm;/proxy_pass http:\/\/\$rest_api_host;/igs' /etc/nginx/conf.d/default.conf > /etc/nginx/conf.d/default.conf.part && \ | ||
echo "include /etc/nginx/upstream.location;" | cat - /etc/nginx/conf.d/default.conf.part > /etc/nginx/conf.d/default.conf | ||
|
||
RUN echo "envsubst '\$REST_API_READ_HOSTNAME,\$REST_API_READ_PORT,\$REST_API_WRITE_HOSTNAME,\$REST_API_WRITE_PORT' < /etc/nginx/upstream.location.template > /etc/nginx/upstream.location && cat /etc/nginx/upstream.location" > /docker-entrypoint.d/40-envsubst-upstream-location.sh && \ | ||
chmod a+x /docker-entrypoint.d/40-envsubst-upstream-location.sh | ||
|
||
CMD ["nginx", "-g", "daemon off;"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
envsubst '$REST_API_READ_HOSTNAME,$REST_API_READ_PORT,$REST_API_WRITE_HOSTNAME,$REST_API_WRITE_PORT' < /etc/nginx/upstream.location.template > /etc/nginx/upstream.location | ||
cat /etc/nginx/upstream.location |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
echo resolver $(awk 'BEGIN{ORS=" "} $1=="nameserver" {print $2}' /etc/resolv.conf) ";" > /etc/nginx/conf.d/resolver.conf |