FROM nginx:1.27-alpine RUN rm -rf /usr/share/nginx/html/* /etc/nginx/conf.d/default.conf && \ mkdir -p /var/cache/nginx/client_temp /var/cache/nginx/proxy_temp \ /var/cache/nginx/fastcgi_temp /var/cache/nginx/uwsgi_temp \ /var/cache/nginx/scgi_temp && \ chown -R 101:101 /var/cache/nginx /etc/nginx/conf.d && \ sed -i -e '/^user /d' -e 's|^pid .*|pid /tmp/nginx.pid;|' /etc/nginx/nginx.conf && \ printf '%s\n' \ 'server {' \ ' listen 8080;' \ ' root /usr/share/nginx/html;' \ ' index index.html;' \ ' server_tokens off;' \ ' gzip on;' \ ' gzip_types text/css application/javascript application/json image/svg+xml;' \ ' location = /healthz { access_log off; return 200 "ok\n"; }' \ ' location /assets/ { expires 1y; add_header Cache-Control "public, immutable"; }' \ ' location = /index.html { add_header Cache-Control "no-cache"; }' \ ' location / { try_files $uri $uri/ /index.html; }' \ '}' > /etc/nginx/conf.d/site.conf COPY dist/ /usr/share/nginx/html/ EXPOSE 8080 USER 101 HEALTHCHECK --interval=30s --timeout=3s --start-period=5s --retries=3 \ CMD wget -qO- http://127.0.0.1:8080/healthz || exit 1 CMD ["nginx", "-g", "daemon off;"]