2026-03-25 11:34:33 +00:00
|
|
|
FROM node:20-alpine as build-stage
|
|
|
|
|
WORKDIR /app
|
|
|
|
|
COPY package*.json ./
|
|
|
|
|
RUN npm install
|
|
|
|
|
COPY . .
|
|
|
|
|
RUN npm run build
|
|
|
|
|
|
2026-03-25 09:59:29 +00:00
|
|
|
FROM nginx:alpine
|
2026-03-25 11:34:33 +00:00
|
|
|
COPY --from=build-stage /app/dist /usr/share/nginx/html
|
|
|
|
|
# Configuración para React Router
|
|
|
|
|
RUN echo 'server { \
|
|
|
|
|
listen 80; \
|
|
|
|
|
location / { \
|
|
|
|
|
root /usr/share/nginx/html; \
|
|
|
|
|
index index.html; \
|
|
|
|
|
try_files $uri $uri/ /index.html; \
|
|
|
|
|
} \
|
|
|
|
|
location /api { \
|
|
|
|
|
proxy_pass http://codigo0-backend:3000; \
|
|
|
|
|
} \
|
|
|
|
|
}' > /etc/nginx/conf.d/default.conf
|
2026-03-25 09:59:29 +00:00
|
|
|
EXPOSE 80
|
|
|
|
|
CMD ["nginx", "-g", "daemon off;"]
|