33 lines
818 B
Docker
33 lines
818 B
Docker
FROM nginx:alpine
|
|
|
|
# Copy static files
|
|
COPY index.html /usr/share/nginx/html/
|
|
COPY images/ /usr/share/nginx/html/images/
|
|
|
|
# Custom nginx config for SPA
|
|
RUN echo 'server { \
|
|
listen 80; \
|
|
server_name _; \
|
|
root /usr/share/nginx/html; \
|
|
index index.html; \
|
|
\
|
|
location / { \
|
|
try_files $uri $uri/ /index.html; \
|
|
} \
|
|
\
|
|
# Cache static assets \
|
|
location ~* \.(css|js|png|jpg|jpeg|gif|ico|svg|woff|woff2)$ { \
|
|
expires 1y; \
|
|
add_header Cache-Control "public, immutable"; \
|
|
} \
|
|
\
|
|
# Security headers \
|
|
add_header X-Frame-Options "SAMEORIGIN" always; \
|
|
add_header X-Content-Type-Options "nosniff" always; \
|
|
add_header X-XSS-Protection "1; mode=block" always; \
|
|
}' > /etc/nginx/conf.d/default.conf
|
|
|
|
EXPOSE 80
|
|
|
|
CMD ["nginx", "-g", "daemon off;"]
|