|
@@ -28,11 +28,28 @@ RUN --mount=type=cache,target=$PNPM_HOME/store,sharing=locked \
|
|
|
pnpm add turbo --global
|
|
pnpm add turbo --global
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
+##
|
|
|
|
|
+## pruner — turbo prune for Docker-optimized monorepo subset
|
|
|
|
|
+##
|
|
|
|
|
+FROM base AS pruner
|
|
|
|
|
+
|
|
|
|
|
+ARG OPT_DIR
|
|
|
|
|
+
|
|
|
|
|
+WORKDIR $OPT_DIR
|
|
|
|
|
+
|
|
|
|
|
+COPY . .
|
|
|
|
|
+
|
|
|
|
|
+# Include @growi/pdf-converter because @growi/pdf-converter-client has a turbo
|
|
|
|
|
+# task dependency on @growi/pdf-converter#gen:swagger-spec (generates the OpenAPI
|
|
|
|
|
+# spec that orval uses to build the client). Without it, turbo cannot resolve
|
|
|
|
|
+# the cross-package task dependency in the pruned workspace.
|
|
|
|
|
+RUN turbo prune @growi/app @growi/pdf-converter --docker
|
|
|
|
|
+
|
|
|
|
|
|
|
|
##
|
|
##
|
|
|
-## builder — build + produce artifacts (current 3-stage COPY . . pattern)
|
|
|
|
|
|
|
+## deps — dependency installation (layer cached when only source changes)
|
|
|
##
|
|
##
|
|
|
-FROM base AS builder
|
|
|
|
|
|
|
+FROM base AS deps
|
|
|
|
|
|
|
|
ARG OPT_DIR
|
|
ARG OPT_DIR
|
|
|
ARG PNPM_HOME
|
|
ARG PNPM_HOME
|
|
@@ -42,13 +59,32 @@ ENV PATH="$PNPM_HOME:$PATH"
|
|
|
|
|
|
|
|
WORKDIR $OPT_DIR
|
|
WORKDIR $OPT_DIR
|
|
|
|
|
|
|
|
-COPY . .
|
|
|
|
|
|
|
+# Copy only package manifests and lockfile for dependency caching
|
|
|
|
|
+COPY --from=pruner $OPT_DIR/out/json/ .
|
|
|
|
|
|
|
|
|
|
+# Install build tools and dependencies
|
|
|
RUN --mount=type=cache,target=$PNPM_HOME/store,sharing=locked \
|
|
RUN --mount=type=cache,target=$PNPM_HOME/store,sharing=locked \
|
|
|
pnpm add node-gyp --global
|
|
pnpm add node-gyp --global
|
|
|
RUN --mount=type=cache,target=$PNPM_HOME/store,sharing=locked \
|
|
RUN --mount=type=cache,target=$PNPM_HOME/store,sharing=locked \
|
|
|
pnpm install --frozen-lockfile
|
|
pnpm install --frozen-lockfile
|
|
|
|
|
|
|
|
|
|
+
|
|
|
|
|
+##
|
|
|
|
|
+## builder — build + produce artifacts
|
|
|
|
|
+##
|
|
|
|
|
+FROM deps AS builder
|
|
|
|
|
+
|
|
|
|
|
+ARG OPT_DIR
|
|
|
|
|
+
|
|
|
|
|
+WORKDIR $OPT_DIR
|
|
|
|
|
+
|
|
|
|
|
+# Copy full source on top of installed dependencies
|
|
|
|
|
+COPY --from=pruner $OPT_DIR/out/full/ .
|
|
|
|
|
+
|
|
|
|
|
+# turbo prune does not include root-level config files in its output.
|
|
|
|
|
+# tsconfig.base.json is referenced by most packages via "extends": "../../tsconfig.base.json"
|
|
|
|
|
+COPY tsconfig.base.json .
|
|
|
|
|
+
|
|
|
# Build
|
|
# Build
|
|
|
RUN turbo run clean
|
|
RUN turbo run clean
|
|
|
RUN turbo run build --filter @growi/app
|
|
RUN turbo run build --filter @growi/app
|
|
@@ -68,7 +104,6 @@ RUN mkdir -p /tmp/release/apps/app && \
|
|
|
(cp apps/app/.env.production* /tmp/release/apps/app/ 2>/dev/null || true)
|
|
(cp apps/app/.env.production* /tmp/release/apps/app/ 2>/dev/null || true)
|
|
|
|
|
|
|
|
|
|
|
|
|
-
|
|
|
|
|
##
|
|
##
|
|
|
## release — DHI runtime (no shell, no additional binaries)
|
|
## release — DHI runtime (no shell, no additional binaries)
|
|
|
##
|
|
##
|