File tree Expand file tree Collapse file tree 3 files changed +21
-18
lines changed Expand file tree Collapse file tree 3 files changed +21
-18
lines changed Original file line number Diff line number Diff line change 1- # Builder
2- FROM node:18-alpine as builder
3- # Reference :: https://pnpm.io/docker
4- ENV PNPM_HOME="/pnpm"
5- ENV PATH="$PNPM_HOME:$PATH"
6- RUN corepack enable
7- WORKDIR /src
1+ FROM node:lts-alpine AS base
82
9- # Cache dependencies first
3+ # Stage 1: Install dependencies
4+ FROM base AS deps
5+ WORKDIR /app
106COPY package.json pnpm-lock.yaml ./
11- RUN pnpm install
7+ RUN corepack enable pnpm && pnpm install --frozen-lockfile
128
13- # Copy other files and build
14- COPY . /src/
15- RUN pnpm build
9+ # Stage 2: Build the application
10+ FROM base AS builder
11+ WORKDIR /app
12+ COPY --from=deps /app/node_modules ./node_modules
13+ COPY . .
14+ RUN corepack enable pnpm && pnpm run build
1615
17- # App
18- FROM nginxinc/nginx-unprivileged
19- COPY --chown=nginx:nginx --from=builder /src/out /app
20- COPY default.conf /etc/nginx/conf.d/default.conf
16+ # Stage 3: Production image
17+ FROM nginx:stable AS production
18+ WORKDIR /app
19+ COPY --from=builder /app/out /app
20+ COPY ./nginx.conf /etc/nginx/conf.d/default.conf
21+
22+ EXPOSE 80
Original file line number Diff line number Diff line change 1- version : ' 3.9'
21services :
32 jsoncrack :
43 image : jsoncrack
@@ -7,4 +6,6 @@ services:
76 context : .
87 dockerfile : Dockerfile
98 ports :
10- - " 8888:8080"
9+ - " 8888:8080"
10+ environment :
11+ - NODE_ENV=production
File renamed without changes.
You can’t perform that action at this time.
0 commit comments