forked from Dokploy/docker-compose-test
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
28 lines (21 loc) · 663 Bytes
/
Copy pathDockerfile
File metadata and controls
28 lines (21 loc) · 663 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
# Dockerfile (Next.js server)
FROM node:20-alpine AS builder
WORKDIR /app
# copiar package.json y lock para instalar deps
COPY package*.json ./
# Opcional: agregar cachebust arg para forzar rebuild cuando quieras
ARG CACHEBUST=1
RUN npm ci
# copiar resto del código y construir
COPY . .
RUN npm run build
# Production image
FROM node:20-alpine AS runner
WORKDIR /app
ENV NODE_ENV=production
# copia desde builder
COPY --from=builder /app ./
# Exponer puerto que usa next start (3000 por defecto)
EXPOSE 3000
# Si usas "next start" (asegúrate package.json tenga "start": "next start -p 3000")
CMD ["sh", "-c", "npm run start"]