|
|
@@ -2,7 +2,6 @@
|
|
|
|
|
|
ARG NODE_VERSION=24
|
|
|
ARG OPT_DIR="/opt"
|
|
|
-ARG PNPM_HOME="/root/.local/share/pnpm"
|
|
|
|
|
|
##
|
|
|
## base
|
|
|
@@ -10,23 +9,19 @@ ARG PNPM_HOME="/root/.local/share/pnpm"
|
|
|
FROM node:${NODE_VERSION}-slim AS base
|
|
|
|
|
|
ARG OPT_DIR
|
|
|
-ARG PNPM_HOME
|
|
|
|
|
|
WORKDIR $OPT_DIR
|
|
|
|
|
|
-# install tools
|
|
|
-RUN --mount=type=cache,target=/var/lib/apt,sharing=locked \
|
|
|
- --mount=type=cache,target=/var/cache/apt,sharing=locked \
|
|
|
- apt-get update && apt-get install -y ca-certificates wget --no-install-recommends
|
|
|
-
|
|
|
-# install pnpm
|
|
|
-RUN wget -qO- https://get.pnpm.io/install.sh | ENV="$HOME/.shrc" SHELL="$(which sh)" PNPM_VERSION="10.32.1" sh -
|
|
|
-ENV PNPM_HOME=$PNPM_HOME
|
|
|
-ENV PATH="$PNPM_HOME:$PATH"
|
|
|
+# Activate corepack so the pnpm version pinned in the workspace package.json
|
|
|
+# "packageManager" field is used (avoids drift between Dockerfile and local/CI).
|
|
|
+RUN corepack enable
|
|
|
+ENV PNPM_HOME="/pnpm"
|
|
|
+ENV PATH="$PNPM_HOME/bin:$PATH"
|
|
|
|
|
|
# install turbo
|
|
|
-RUN --mount=type=cache,target=$PNPM_HOME/store,sharing=locked \
|
|
|
- pnpm add turbo --global
|
|
|
+# Note: no cache mount here — pnpm global install links binaries into the store,
|
|
|
+# and the BuildKit cache mount would be unmounted after RUN, breaking those links.
|
|
|
+RUN pnpm add turbo --global
|
|
|
|
|
|
|
|
|
|
|
|
@@ -35,15 +30,12 @@ RUN --mount=type=cache,target=$PNPM_HOME/store,sharing=locked \
|
|
|
##
|
|
|
FROM base AS builder
|
|
|
|
|
|
-ENV PNPM_HOME=$PNPM_HOME
|
|
|
-ENV PATH="$PNPM_HOME:$PATH"
|
|
|
-
|
|
|
WORKDIR $OPT_DIR
|
|
|
|
|
|
COPY . .
|
|
|
|
|
|
-RUN --mount=type=cache,target=$PNPM_HOME/store,sharing=locked \
|
|
|
- pnpm install ---frozen-lockfile
|
|
|
+RUN --mount=type=cache,id=pnpm,target=/pnpm/store \
|
|
|
+ pnpm install --frozen-lockfile --ignore-scripts
|
|
|
|
|
|
# build
|
|
|
RUN turbo run clean
|