diff --git a/frontend/Dockerfile b/frontend/Dockerfile index ac0834c..95733d3 100644 --- a/frontend/Dockerfile +++ b/frontend/Dockerfile @@ -1,4 +1,4 @@ -FROM node:20-alpine +FROM node:20-alpine AS build WORKDIR /app @@ -6,5 +6,13 @@ COPY package.json package-lock.json* ./ RUN npm install COPY . . +RUN npm run build -CMD ["npm", "run", "dev", "--", "--host", "0.0.0.0", "--port", "3000"] +FROM nginx:1.27-alpine + +COPY nginx.conf /etc/nginx/conf.d/default.conf +COPY --from=build /app/dist /usr/share/nginx/html + +EXPOSE 3000 + +CMD ["nginx", "-g", "daemon off;"] diff --git a/frontend/nginx.conf b/frontend/nginx.conf new file mode 100644 index 0000000..2a5e28d --- /dev/null +++ b/frontend/nginx.conf @@ -0,0 +1,35 @@ +server { + listen 3000; + server_name _; + root /usr/share/nginx/html; + index index.html; + + include /etc/nginx/mime.types; + types { + application/manifest+json webmanifest; + } + + location = /manifest.webmanifest { + add_header Cache-Control "no-cache, no-store, must-revalidate"; + try_files $uri =404; + } + + location = /sw.js { + add_header Cache-Control "no-cache, no-store, must-revalidate"; + try_files $uri =404; + } + + location /icons/ { + add_header Cache-Control "no-cache, no-store, must-revalidate"; + try_files $uri =404; + } + + location /assets/ { + add_header Cache-Control "public, max-age=31536000, immutable"; + try_files $uri =404; + } + + location / { + try_files $uri $uri/ /index.html; + } +}