|
|
@@ -2,7 +2,6 @@
|
|
|
|
|
|
ARG NODE_VERSION=24
|
|
|
ARG OPT_DIR="/opt"
|
|
|
-ARG PNPM_HOME="/root/.local/share/pnpm"
|
|
|
|
|
|
##
|
|
|
## base — official Node.js image with pnpm + turbo
|
|
|
@@ -10,17 +9,18 @@ ARG PNPM_HOME="/root/.local/share/pnpm"
|
|
|
FROM node:24-bookworm AS base
|
|
|
|
|
|
ARG OPT_DIR
|
|
|
-ARG PNPM_HOME
|
|
|
|
|
|
WORKDIR $OPT_DIR
|
|
|
|
|
|
-# Install pnpm (standalone script, no version hardcoding)
|
|
|
-RUN wget -qO- https://get.pnpm.io/install.sh | ENV="$HOME/.shrc" SHELL=/bin/sh sh -
|
|
|
-ENV PNPM_HOME=$PNPM_HOME
|
|
|
-ENV PATH="$PNPM_HOME:$PNPM_HOME/bin:$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:$PATH"
|
|
|
|
|
|
# Install turbo globally
|
|
|
-RUN pnpm add turbo --global
|
|
|
+RUN --mount=type=cache,id=pnpm,target=/pnpm/store \
|
|
|
+ pnpm add turbo --global
|
|
|
|
|
|
|
|
|
##
|
|
|
@@ -47,20 +47,15 @@ RUN turbo prune @growi/app @growi/pdf-converter --docker
|
|
|
FROM base AS deps
|
|
|
|
|
|
ARG OPT_DIR
|
|
|
-ARG PNPM_HOME
|
|
|
-
|
|
|
-ENV PNPM_HOME=$PNPM_HOME
|
|
|
-ENV PATH="$PNPM_HOME:$PNPM_HOME/bin:$PATH"
|
|
|
|
|
|
WORKDIR $OPT_DIR
|
|
|
|
|
|
# Copy only package manifests and lockfile for dependency caching
|
|
|
COPY --from=pruner $OPT_DIR/out/json/ .
|
|
|
|
|
|
-# Separate store path keeps the BuildKit cache mount away from the pnpm bootstrap store.
|
|
|
# --ignore-scripts: postinstall (prisma generate) needs full source, runs in builder stage.
|
|
|
-RUN --mount=type=cache,target=/root/.pnpm-store,sharing=locked \
|
|
|
- pnpm install --frozen-lockfile --ignore-scripts --store-dir /root/.pnpm-store
|
|
|
+RUN --mount=type=cache,id=pnpm,target=/pnpm/store \
|
|
|
+ pnpm install --frozen-lockfile --ignore-scripts
|
|
|
|
|
|
|
|
|
##
|