-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
36 lines (25 loc) · 796 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
ARG NODE_IMAGE=node:20.11.1
FROM $NODE_IMAGE AS base
# Install dumb-init
RUN apt-get update && apt-get install -y dumb-init && apt-get clean
# Install pnpm globally
RUN npm install -g pnpm
RUN mkdir -p /home/node/app && chown node:node /home/node/app
WORKDIR /home/node/app
USER node
RUN mkdir tmp
FROM base AS dependencies
COPY --chown=node:node ./pnpm-lock.yaml ./
COPY --chown=node:node ./package*.json ./
# Install dependencies using pnpm
RUN pnpm install
COPY --chown=node:node . .
FROM dependencies AS build
RUN pnpm run build --prod
FROM base AS production
COPY --chown=node:node ./pnpm-lock.yaml ./
COPY --chown=node:node ./package*.json ./
RUN pnpm install --prod
COPY --chown=node:node --from=build /home/node/app/build .
EXPOSE $PORT
CMD [ "dumb-init", "node", "server.js" ]