-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathDockerfile
33 lines (25 loc) · 885 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
FROM node:18-alpine AS builder
WORKDIR /temp
COPY package.json package.json
COPY yarn.lock yarn.lock
ENV NODE_ENV=development
RUN ["yarn", "install", "--frozen-lockfile", "--ignore-engines"]
COPY . .
ENV NODE_ENV=production
RUN ["yarn", "build"]
RUN ["yarn", "install", "--frozen-lockfile", "--production", "--ignore-engines"]
# Production stage, thinner image with only what we need
FROM node:18-alpine AS production
WORKDIR /srv
COPY --from=builder /temp/.env.defaults .env.defaults
COPY --from=builder /temp/build build
COPY --from=builder /temp/license license
COPY --from=builder /temp/package.json package.json
COPY --from=builder /temp/storage storage
COPY --from=builder /temp/version version
COPY --from=builder /temp/yarn.lock yarn.lock
COPY --from=builder /temp/node_modules node_modules
ENV NODE_ENV=production
ENV PORT=7200
USER node
ENTRYPOINT [ "yarn", "start" ]