diff --git a/frontend/Dockerfile b/frontend/Dockerfile index b822ada..790925e 100644 --- a/frontend/Dockerfile +++ b/frontend/Dockerfile @@ -25,8 +25,8 @@ FROM nginx:alpine # Copy built app COPY --from=build /app/dist /usr/share/nginx/html -# Copy nginx config (if exists) -# COPY nginx.conf /etc/nginx/nginx.conf +# Copy nginx config for SPA routing +COPY nginx.conf /etc/nginx/conf.d/default.conf # Expose port EXPOSE 80 diff --git a/frontend/nginx.conf b/frontend/nginx.conf new file mode 100644 index 0000000..4c2bd47 --- /dev/null +++ b/frontend/nginx.conf @@ -0,0 +1,17 @@ +server { + listen 80; + server_name localhost; + root /usr/share/nginx/html; + index index.html; + + # SPA routing - serve index.html for all routes + location / { + try_files $uri $uri/ /index.html; + } + + # Cache static assets + location ~* \.(js|css|png|jpg|jpeg|gif|ico|svg)$ { + expires 1y; + add_header Cache-Control "public, immutable"; + } +}