-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile
41 lines (29 loc) · 925 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
FROM node:20-bullseye-slim as base
RUN npm install -g [email protected]
ENV NODE_ENV production
ARG APPLICATION_PORT=8080
ENV PORT ${APPLICATION_PORT}
ENV NODE_ENV production
ENV HOST 0.0.0.0
FROM base as deps
WORKDIR /app
ADD package.json .npmrc pnpm-lock.yaml ./
RUN pnpm install --production=false --frozen-lockfile --prefer-offline --config.ignore-scripts=true
FROM base as production-deps
WORKDIR /app
COPY --from=deps /app/node_modules /app/node_modules
ADD package.json .npmrc ./
RUN pnpm prune --prod --config.ignore-scripts=true
FROM base as build
WORKDIR /app
COPY --from=deps /app/node_modules /app/node_modules
ADD . .
RUN pnpm run build
FROM base
WORKDIR /app
COPY --from=production-deps /app/node_modules /app/node_modules
COPY --from=build /app/build /app/build
COPY --from=build /app/public /app/public
COPY --from=build /app/package.json /app/package.json
EXPOSE $APPLICATION_PORT
CMD ["pnpm", "start"]