diff --git a/frontend/Dockerfile b/frontend/Dockerfile index 6602208d..fad87105 100755 --- a/frontend/Dockerfile +++ b/frontend/Dockerfile @@ -43,7 +43,7 @@ COPY --from=builder /usr/src/app/certs/privkey.pem /etc/nginx/privkey.pem # install CONFD RUN apt-get update && apt-get install -y curl && apt-get clean -COPY ./confd/templates/nginx.conf /etc/nginx/nginx.conf +COPY ./confd/templates/nginx.conf /etc/nginx/nginx.conf.tmpl ## OLD CONFD THINGS (not compatible with arm) #ENV CONFD_VERSION 0.16.0 @@ -51,10 +51,10 @@ COPY ./confd/templates/nginx.conf /etc/nginx/nginx.conf # chmod +x /usr/local/bin/confd #COPY ./confd /etc/confd # rewrite command & entrypoint with ours -#COPY ./entrypoint.sh / -#ENTRYPOINT [ "/entrypoint.sh" ] -RUN export BACKEND_HOSTNAME=shuffle-backend +COPY ./entrypoint.sh / +ENV BACKEND_HOSTNAME="shuffle-backend" +ENTRYPOINT [ "/entrypoint.sh" ] CMD ["nginx", "-g", "daemon off;"] EXPOSE 80 diff --git a/frontend/confd/templates/nginx.conf b/frontend/confd/templates/nginx.conf index a119d69d..2c9df91e 100755 --- a/frontend/confd/templates/nginx.conf +++ b/frontend/confd/templates/nginx.conf @@ -71,8 +71,7 @@ http { } location ~ /api/v(1|2) { - #proxy_pass http://{{ getenv "BACKEND_HOSTNAME" "shuffle-backend" }}:5001; - proxy_pass http://$BACKEND_HOSTNAME:5001; + proxy_pass http://${BACKEND_HOSTNAME}:5001; proxy_buffering off; proxy_http_version 1.1; @@ -114,7 +113,8 @@ http { # Get the hostname from environment here? location ~ /api/v(1|2) { - proxy_pass http://$BACKEND_HOSTNAME:5001; + proxy_pass http://${BACKEND_HOSTNAME}:5001; + proxy_buffering off; proxy_http_version 1.1; diff --git a/frontend/entrypoint.sh b/frontend/entrypoint.sh index f5542b05..af1d0a43 100755 --- a/frontend/entrypoint.sh +++ b/frontend/entrypoint.sh @@ -1,8 +1,6 @@ -#!/bin/bash +#!/usr/bin/env sh +set -eu -# generate configs - is this necessary? -# Removing confd if possible -#/usr/local/bin/confd -backend="env" -confdir="/etc/confd" -onetime +envsubst '${BACKEND_HOSTNAME}' < /etc/nginx/nginx.conf.tmpl > /etc/nginx/nginx.conf -# run main command exec "$@"