add support for configuring server url. fixes #11

This commit is contained in:
Thomas Amland
2020-09-19 09:23:25 +02:00
parent f22c03d2c8
commit 419f26b8bf
9 changed files with 45 additions and 6 deletions
+7
View File
@@ -2,5 +2,12 @@ FROM nginx:alpine
EXPOSE 80
RUN apk add gettext
COPY docker/nginx.conf /etc/nginx/conf.d/default.conf
COPY docker/env.js.template /env.js.template
COPY docker/docker-entrypoint.sh /docker-entrypoint.sh
RUN chmod +x /docker-entrypoint.sh
COPY dist/ /var/www/html/
ENTRYPOINT ["/docker-entrypoint.sh"]
CMD ["nginx", "-g", "daemon off;"]
+4
View File
@@ -0,0 +1,4 @@
#!/bin/sh
set -e
envsubst < env.js.template > /var/www/html/env.js
exec "$@"
+3
View File
@@ -0,0 +1,3 @@
window.env = {
SERVER_URL: "$SERVER_URL",
}
+4
View File
@@ -17,4 +17,8 @@ server {
location = /index.html {
add_header 'Cache-Control' 'no-cache';
}
location = /env.js {
add_header 'Cache-Control' 'no-cache';
}
}