-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile
44 lines (30 loc) · 864 Bytes
/
Dockerfile
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
37
38
39
40
41
42
43
44
FROM node:16-alpine as base
FROM base as builder
WORKDIR /app
COPY package.json .
COPY yarn.lock .
COPY .yarnrc.yml .
COPY .pnp.cjs .
COPY .pnp.loader.mjs .
COPY .yarn ./.yarn
RUN npm install -g pm2
RUN yarn install
COPY . .
RUN yarn build
FROM base AS runner
WORKDIR /app
COPY --from=builder /app/.yarn/releases ./.yarn/releases
COPY --from=builder /app/.yarn/cache ./.yarn/cache
COPY --from=builder /app/.yarn/unplugged ./.yarn/unplugged
COPY --from=builder /app/dist ./dist
COPY --from=builder /app/.env ./.env
COPY --from=builder /app/.pnp.cjs ./.pnp.cjs
COPY --from=builder /app/package.json ./package.json
COPY --from=builder /app/yarn.lock ./yarn.lock
COPY --from=builder /app/.yarnrc.yml ./.yarnrc.yml
COPY --from=builder /app/pm2.yml ./pm2.yml
ENV NODE_ENV production
ENV PORT 4000
ENV HOSTNAME 0.0.0.0
EXPOSE 4000
CMD ["yarn", "start:prod"]