Elffuss BraidHub

kikocis/dataspace-portal public

main · 1.2 KiBRawPermalink
1FROM docker.io/nginxinc/nginx-unprivileged:1.27-alpine3.20
2
3# Temporarily switch to root to install packages and create symlink in restricted location
4USER root
5RUN apk update && apk add --no-cache jq curl
6
7COPY dist/app /usr/share/nginx/html
8COPY docker/default.conf.template etc/nginx/templates/default.conf.template
9# Before starting nginx, apply ENV vars to create app-config.json from AUTHORITY_PORTAL_FRONTEND_* ENV Vars
10# Use an entrypoint drop-in instead of modifying the default entrypoint or command,
11# so that the automatic envsubst templating is not disabled.
12COPY docker/99-generate-app-config.sh /docker-entrypoint.d/99-generate-app-config.sh
13
14RUN ln -sf /tmp/app-config.json /usr/share/nginx/html/assets/config/app-configuration.json \
15 # Nginx is configured to reject symlinks that point to a file owned by a different user, for security reasons
16 && chown --no-dereference nginx:root /usr/share/nginx/html/assets/config/app-configuration.json
17
18# Switch back to unprivileged user for runtime
19USER nginx:nginx
20
21ENV NGINX_BIND="0.0.0.0"
22ENV NGINX_PORT=8080
23
24HEALTHCHECK --interval=2s --timeout=5s --retries=10 \
25 CMD curl -f http://${NGINX_BIND:"localhost"}:$NGINX_PORT/ || exit 1