-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathDockerfile.backend
More file actions
33 lines (24 loc) · 930 Bytes
/
Dockerfile.backend
File metadata and controls
33 lines (24 loc) · 930 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
29
30
31
32
33
#Build stage
FROM node:25-alpine AS builder
ARG NPM_TOKEN
WORKDIR /builder
COPY ./.npmrc ./
COPY ./package.json ./package-lock.json ./
COPY ./tsconfig.base.json ./
COPY ./shared ./shared
COPY ./apps/backend ./apps/backend
RUN npm ci && npm run build --workspace=@wxyc/database --workspace=shared/** --workspace=@wxyc/backend
#Production stage
FROM node:25-alpine AS prod
ARG NPM_TOKEN
WORKDIR /application
COPY ./.npmrc ./
COPY ./package* ./
COPY ./apps/backend/package* ./apps/backend/
COPY ./shared/database/package* ./shared/database/
COPY ./shared/authentication/package* ./shared/authentication/
RUN npm install --omit=dev && rm -f .npmrc
COPY --from=builder ./builder/apps/backend/dist ./apps/backend/dist
COPY --from=builder ./builder/shared/database/dist ./shared/database/dist
COPY --from=builder ./builder/shared/authentication/dist ./shared/authentication/dist
CMD ["npm", "start", "--workspace=@wxyc/backend"]