salomonsky commited on
Commit
8a62c01
·
verified ·
1 Parent(s): 8eba362

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +13 -13
Dockerfile CHANGED
@@ -1,20 +1,20 @@
1
- # Usamos la imagen base
2
- FROM node:20-alpine
3
-
4
  WORKDIR /app
5
-
6
- # 1. Copiamos configuración y dependencias
7
  COPY package.json .
8
-
9
- # 2. Instalamos todo
10
  RUN npm install
11
-
12
- # 3. Copiamos el código fuente (jsx, css, etc.)
13
  COPY . .
 
 
 
 
 
 
 
 
 
14
 
15
- # 4. Exponemos el puerto 7860
16
  EXPOSE 7860
17
 
18
- # 5. Arrancamos en MODO DESARROLLO
19
- # Esto ejecutará: vite --host 0.0.0.0 --port 7860
20
- CMD ["npm", "run", "start"]
 
1
+ # --- ETAPA 1: Construir el Frontend de React ---
2
+ FROM node:20-alpine AS builder
 
3
  WORKDIR /app
 
 
4
  COPY package.json .
 
 
5
  RUN npm install
 
 
6
  COPY . .
7
+ RUN npm run build
8
+
9
+ # --- ETAPA 2: Servidor de Producción ---
10
+ FROM node:20-alpine
11
+ WORKDIR /app
12
+ COPY package.json .
13
+ RUN npm install --omit=dev
14
+ COPY server.mjs .
15
+ COPY --from=builder /app/dist ./dist
16
 
17
+ # CAMBIO: Exponer puerto 7860
18
  EXPOSE 7860
19
 
20
+ CMD ["node", "server.mjs"]