jinnosux revised this gist 2 weeks ago. Go to revision
1 file changed, 22 insertions
Dockerfile test?? (file created)
| @@ -0,0 +1,22 @@ | |||
| 1 | + | # Stage 1: Dependencies and Build | |
| 2 | + | FROM node:22-alpine AS builder | |
| 3 | + | WORKDIR /app | |
| 4 | + | COPY package*.json ./ | |
| 5 | + | RUN npm ci | |
| 6 | + | COPY . . | |
| 7 | + | RUN npm run build | |
| 8 | + | ||
| 9 | + | # Stage 2: Production Runner | |
| 10 | + | FROM node:22-alpine AS runner | |
| 11 | + | WORKDIR /app | |
| 12 | + | ENV NODE_ENV=production | |
| 13 | + | ||
| 14 | + | COPY --from=builder /app/.next/standalone ./ | |
| 15 | + | COPY --from=builder /app/.next/static ./.next/static | |
| 16 | + | COPY --from=builder /app/public ./public | |
| 17 | + | ||
| 18 | + | EXPOSE 3000 | |
| 19 | + | ENV PORT=3000 | |
| 20 | + | ENV HOSTNAME="0.0.0.0" | |
| 21 | + | ||
| 22 | + | CMD ["node", "server.js"] | |
Newer
Older