FROM nginx:alpine
COPY dist/ /usr/share/nginx/html/
RUN printf 'server {\n  listen 80;\n  server_name _;\n  root /usr/share/nginx/html;\n  index index.html;\n  gzip on;\n  gzip_types text/plain text/css application/javascript application/json image/svg+xml;\n  gzip_min_length 256;\n  \n  # CORS headers for module scripts\n  add_header Access-Control-Allow-Origin "*" always;\n  \n  location ~* \\.(js|css|json|png|jpg|webp|svg|ico|woff2?)$ {\n    expires 1h;\n    add_header Cache-Control "public, max-age=3600";\n    add_header Access-Control-Allow-Origin "*" always;\n  }\n  \n  location / {\n    try_files $uri $uri/ /index.html;\n  }\n}\n' > /etc/nginx/conf.d/default.conf