diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..0f0e4e5 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,14 @@ +# Stage 1: Build Vite SPA +FROM node:22-alpine AS build +WORKDIR /app +COPY package*.json ./ +RUN npm ci +COPY . . +RUN npm run build + +# Stage 2: Production Nginx Server +FROM nginx:alpine +COPY --from=build /app/dist /usr/share/nginx/html +COPY --from=build /app/nginx.conf /etc/nginx/conf.d/default.conf +EXPOSE 80 +CMD ["nginx", "-g", "daemon off;"] diff --git a/nginx.conf b/nginx.conf new file mode 100644 index 0000000..1255afe --- /dev/null +++ b/nginx.conf @@ -0,0 +1,15 @@ +server { + listen 80; + server_name _; + + location / { + root /usr/share/nginx/html; + index index.html index.htm; + try_files $uri $uri/ /index.html; + } + + error_page 500 502 503 504 /5x.x.html; + location = /5x.x.html { + root /usr/share/nginx/html; + } +}