Spaces:
Sleeping
Sleeping
| # Stage 1: Build Frontend (Angular 19) | |
| FROM node:20-alpine AS frontend-builder | |
| WORKDIR /app/frontend | |
| COPY frontend/package*.json ./ | |
| RUN npm ci | |
| COPY frontend/ ./ | |
| RUN npm run build:prod | |
| # Stage 2: Build Backend (NestJS) | |
| FROM node:20-alpine AS backend-builder | |
| WORKDIR /app/backend | |
| COPY backend/package*.json ./ | |
| RUN npm install | |
| COPY backend/ ./ | |
| RUN npm run build | |
| # Stage 3: Final Production Image | |
| FROM node:20-alpine | |
| WORKDIR /app | |
| RUN apk add --no-cache nginx | |
| # Copiamos el backend compilado | |
| COPY --from=backend-builder /app/backend/dist ./dist | |
| COPY --from=backend-builder /app/backend/node_modules ./node_modules | |
| COPY --from=backend-builder /app/backend/package*.json ./ | |
| # Copiamos el frontend compilado a la ruta de Nginx | |
| COPY --from=frontend-builder /app/frontend/dist/medicode-temp/browser /usr/share/nginx/html | |
| COPY nginx.conf /etc/nginx/http.d/default.conf | |
| # Script de arranque | |
| COPY start.sh ./start.sh | |
| RUN chmod +x start.sh | |
| EXPOSE 7860 | |
| CMD ["sh", "start.sh"] |