diff --git a/Dockerfile b/Dockerfile index dc3a113..39d050d 100644 --- a/Dockerfile +++ b/Dockerfile @@ -21,14 +21,21 @@ RUN $(npm bin)/ng build --configuration production FROM nginxinc/nginx-unprivileged:stable-alpine +# Clear all original files USER root RUN rm -rf /usr/share/nginx/html/* USER nginx COPY default.conf /etc/nginx/conf.d/default.conf -COPY nginx-basehref.sh /docker-entrypoint.d/90-basehref.sh +COPY scripts/settings-from-env.sh /usr/local/bin +COPY scripts/nginx-basehref.sh /docker-entrypoint.d/90-basehref.sh COPY --from=builder /ng-app/dist /usr/share/nginx/html +USER root +RUN chmod 755 /usr/local/bin/settings-from-env.sh && \ + chown nginx:nginx /usr/share/nginx/html/assets/config +USER nginx + EXPOSE 8080 -ENTRYPOINT ["nginx", "-g", "daemon off;"] +CMD ["nginx", "-g", "daemon off;"] diff --git a/nginx-basehref.sh b/scripts/nginx-basehref.sh similarity index 100% rename from nginx-basehref.sh rename to scripts/nginx-basehref.sh diff --git a/scripts/settings-from-env.sh b/scripts/settings-from-env.sh new file mode 100644 index 0000000..1894432 --- /dev/null +++ b/scripts/settings-from-env.sh @@ -0,0 +1,4 @@ +#!/bin/sh +set -e +echo $SETTINGS > /usr/share/nginx/html/assets/config/settings.env.json +nginx -g "daemon off;" \ No newline at end of file