FROM node:20-alpine as build-stage WORKDIR /app COPY package*.json ./ RUN npm install COPY . . RUN npm run build FROM nginx:alpine 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 EXPOSE 80 CMD ["nginx", "-g", "daemon off;"]