diff --git a/frontend/Dockerfile b/frontend/Dockerfile index c3f5271..56c307e 100644 --- a/frontend/Dockerfile +++ b/frontend/Dockerfile @@ -7,8 +7,16 @@ ARG VITE_API_URL ENV VITE_API_URL=$VITE_API_URL RUN npm run build -FROM node:20-alpine -WORKDIR /app -COPY --from=builder /app ./ -EXPOSE 3000 -CMD ["npx", "vite", "--port", "3000"] +# Stage 2: Serve with NGINX +FROM nginx:alpine + +# Clean out default config +RUN rm /etc/nginx/conf.d/default.conf + +# Copy your custom nginx config +COPY nginx.conf /etc/nginx/conf.d/default.conf + +# Copy built files from Vite +COPY --from=builder /app/dist /usr/share/nginx/html + +EXPOSE 80 diff --git a/frontend/nginx.conf b/frontend/nginx.conf new file mode 100644 index 0000000..8032709 --- /dev/null +++ b/frontend/nginx.conf @@ -0,0 +1,11 @@ +server { + listen 80; + server_name localhost; + + root /usr/share/nginx/html; + index index.html; + + location / { + try_files $uri /index.html; + } +}