Skip to content

Commit c281592

Browse files
committed
ci(build): update Dockerfile to Node 24 and use pnpm via corepack
Switch base images to node:24-trixie-slim, enable corepack and PNPM env vars, replace npm commands with pnpm, add pnpm-lock.yaml copy, and use a cache-mounted pnpm store for installs (build and runtime).
1 parent 1bdce7e commit c281592

File tree

1 file changed

+19
-8
lines changed

1 file changed

+19
-8
lines changed

Dockerfile

Lines changed: 19 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,36 @@
1-
FROM node:20-slim as build
1+
FROM node:24-trixie-slim as build
2+
ENV PNPM_HOME="/pnpm"
3+
ENV PATH="$PNPM_HOME:$PATH"
4+
ENV CI=true
5+
RUN corepack enable
26
WORKDIR /home/node/
37
COPY . .
4-
RUN npm pkg delete scripts.prepare
8+
RUN pnpm pkg delete scripts.prepare
59

610
RUN apt update
711
RUN apt install -y python3 libcurl4-openssl-dev libssl-dev build-essential
812

9-
RUN npm ci
10-
RUN npm run build
13+
RUN corepack install
14+
RUN --mount=type=cache,id=pnpm,target=/pnpm/store pnpm install --frozen-lockfile
15+
RUN pnpm run build
1116

12-
FROM node:20-slim
17+
FROM node:24-trixie-slim
18+
ENV PNPM_HOME="/pnpm"
19+
ENV PATH="$PNPM_HOME:$PATH"
20+
ENV CI=true
21+
RUN corepack enable
1322
LABEL org.opencontainers.image.source=https://github.com/LEDBrain/Community-Service
1423
LABEL org.opencontainers.image.licenses=MIT
1524

1625
WORKDIR /home/node/
17-
COPY --from=build /home/node/package*.json ./
26+
COPY --from=build /home/node/package.json ./
27+
COPY --from=build /home/node/pnpm-lock.yaml ./
1828
COPY --from=build /home/node/dist ./
1929
COPY --from=build /home/node/prisma ./prisma
2030
RUN apt update
2131
RUN apt install -y python3 libcurl4-openssl-dev libssl-dev build-essential openssl
22-
RUN npm ci --omit=dev
32+
RUN corepack install
33+
RUN --mount=type=cache,id=pnpm,target=/pnpm/store pnpm install --frozen-lockfile --prod
2334
# USER root
2435

2536
EXPOSE 3000
@@ -31,4 +42,4 @@ ENV DATABASE_URL $DATABASE_URL
3142
ENV PORT 3000
3243
ENV HOST $HOSTNAME
3344

34-
CMD npm run migrate:prod && node ./src/index.js
45+
CMD pnpm run migrate:prod && node ./src/index.js

0 commit comments

Comments
 (0)