File tree Expand file tree Collapse file tree 1 file changed +60
-0
lines changed
Expand file tree Collapse file tree 1 file changed +60
-0
lines changed Original file line number Diff line number Diff line change 1+ # Stage 1: builder
2+ FROM node:22-alpine AS builder
3+
4+ WORKDIR /app
5+
6+ # install pnpm & git
7+ RUN npm install -g pnpm
8+ RUN apk update && \
9+ apk upgrade && \
10+ apk add --no-cache git
11+
12+ RUN git init
13+
14+
15+ # copy lock, package files and configs
16+ COPY package.json pnpm-lock.yaml ./
17+ COPY run-jiti.js ./
18+ COPY src/features/build-info/script-to-generate-json.ts src/features/build-info/build-info.gen.json ./src/features/build-info/
19+ COPY prisma/schema.prisma ./prisma/
20+ RUN pnpm install --frozen-lockfile --prod=false
21+
22+ # copy source
23+ COPY . .
24+
25+ # build .output
26+ ENV NODE_OPTIONS=--max-old-space-size=4096
27+ RUN pnpm build
28+
29+
30+ # Stage 2: runtime
31+ FROM node:22-alpine AS runtime
32+
33+
34+ WORKDIR /app
35+
36+ # install pnpm
37+ RUN npm install -g pnpm
38+ RUN npm install -g npm-run-all
39+
40+
41+ # # copy output build and package.json from builder
42+ COPY --from=builder /app/.output ./.output
43+ COPY --from=builder /app/package.json ./package.json
44+ COPY --from=builder /app/src/features/build-info/build-info.gen.json ./src/features/build-info/build-info.gen.json
45+ COPY --from=builder /app/src/features/build-info/script-to-generate-json.ts ./src/features/build-info/script-to-generate-json.ts
46+
47+ # install only production dependencies
48+
49+
50+ RUN pnpm install --prod
51+
52+ ENV NODE_ENV=production
53+
54+ ENV HOST=0.0.0.0
55+ ENV PORT=3000
56+
57+ EXPOSE 3000
58+
59+ # start
60+ CMD ["pnpm" , "start" ]
You can’t perform that action at this time.
0 commit comments