forked from boostcampwm-2024/web30-stop-troublepainter
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile.server
36 lines (23 loc) · 890 Bytes
/
Dockerfile.server
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
29
30
31
32
33
34
35
36
FROM node:20-alpine AS builder
RUN corepack enable && corepack prepare [email protected] --activate
WORKDIR /app
COPY pnpm-workspace.yaml package.json pnpm-lock.yaml ./
COPY core/package.json ./core/
COPY server/package.json ./server/
RUN pnpm install --frozen-lockfile
COPY . .
RUN pnpm --filter @troublepainter/core build
RUN pnpm --filter server build
FROM node:20-alpine AS production
WORKDIR /app
COPY --from=builder /app/pnpm-workspace.yaml ./
COPY --from=builder /app/server/package.json ./server/package.json
COPY --from=builder /app/server/dist ./server/dist
COPY --from=builder /app/core/package.json ./core/package.json
COPY --from=builder /app/core/dist ./core/dist
RUN corepack enable && corepack prepare [email protected] --activate && cd server && pnpm install --prod
WORKDIR /app/server
ENV NODE_ENV=production
ENV PORT=3000
EXPOSE 3000
CMD ["node", "dist/main.js"]