11FROM node:24.12-bookworm AS base
22
3+ RUN apt-get update \
4+ && apt-get -y --no-install-recommends install \
5+ sudo curl git ca-certificates build-essential dumb-init \
6+ && rm -rf /var/lib/apt/lists/*
37
4- # -------------------------------------------------------
5- # get the init system
6- FROM base AS tools
7-
8- # update packages and install the minimal init system "dumb-init"
9- RUN apt-get update && apt-get install -y --no-install-recommends dumb-init
8+ SHELL ["/bin/bash" , "-o" , "pipefail" , "-c" ]
9+ ENV MISE_INSTALL_PATH="/usr/local/bin/mise"
1010
11+ # Install mise
12+ RUN curl https://mise.run | sh
1113
1214# -------------------------------------------------------
1315FROM base AS build
1416
1517WORKDIR /app
16- COPY package.json yarn. lock .yarnrc.yml ./
17- # We need a specific command because we need to copy the folder with it, not just the content.
18- COPY .yarn/releases ./.yarn/releases/
19- RUN yarn set version berry && yarn install --immutable
18+ COPY package.json pnpm- lock.yaml pnpm-workspace.yaml mise.toml ./
19+
20+ ENV COREPACK_ENABLE_DOWNLOAD_PROMPT=0
21+ RUN mise trust && mise install && corepack enable && pnpm install --frozen-lockfile
2022
2123ENV NODE_ENV=production
2224COPY . .
23- RUN yarn build-ts
24-
25- # -------------------------------------------------------
26- FROM base AS deps
27-
28- WORKDIR /app
29- COPY package.json yarn.lock .yarnrc.yml ./
30- # We need a specific command because we need to copy the folder with it, not just the content.
31- COPY .yarn/releases ./.yarn/releases/
32- RUN yarn set version berry && yarn workspaces focus --all --production
25+ RUN pnpm build-ts
3326
27+ RUN pnpm install --prod --frozen-lockfile
3428
3529# -------------------------------------------------------
3630# Final step that will run the application
@@ -49,10 +43,10 @@ ENV NODE_ENV=production
4943WORKDIR /app
5044
5145# Copy the installed dumb-init system from build image
52- COPY --from=tools /usr/bin/dumb-init /usr/bin/dumb-init
46+ COPY --from=base /usr/bin/dumb-init /usr/bin/dumb-init
5347
5448# Copy the dependencies and compiled server code
55- COPY --chown=node:node --from=deps ./app/node_modules ./node_modules
49+ COPY --chown=node:node --from=build ./app/node_modules ./node_modules
5650COPY --chown=node:node --from=build ./app/dist ./dist
5751
5852# Set user to be non-root node
0 commit comments