Docker イメージビルド時、package.json をコピーする前に pnpm fetch するように (MisskeyIO#217)

This commit is contained in:
riku6460 2023-11-07 05:49:29 +09:00 committed by GitHub
parent 825e99e46d
commit fe16916c72
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -18,15 +18,18 @@ RUN corepack enable
WORKDIR /misskey WORKDIR /misskey
COPY --link ["pnpm-lock.yaml", "pnpm-workspace.yaml", "package.json", "./"] COPY --link pnpm-lock.yaml ./
RUN --mount=type=cache,target=/root/.local/share/pnpm/store,sharing=locked \
pnpm fetch
COPY --link ["pnpm-workspace.yaml", "package.json", "./"]
COPY --link ["scripts", "./scripts"] COPY --link ["scripts", "./scripts"]
COPY --link ["packages/backend/package.json", "./packages/backend/"] COPY --link ["packages/backend/package.json", "./packages/backend/"]
COPY --link ["packages/frontend/package.json", "./packages/frontend/"] COPY --link ["packages/frontend/package.json", "./packages/frontend/"]
COPY --link ["packages/sw/package.json", "./packages/sw/"] COPY --link ["packages/sw/package.json", "./packages/sw/"]
COPY --link ["packages/misskey-js/package.json", "./packages/misskey-js/"] COPY --link ["packages/misskey-js/package.json", "./packages/misskey-js/"]
RUN --mount=type=cache,target=/root/.local/share/pnpm/store,sharing=locked \ RUN pnpm i --frozen-lockfile --aggregate-output --offline
pnpm i --frozen-lockfile --aggregate-output
COPY --link . ./ COPY --link . ./
@ -48,12 +51,15 @@ RUN corepack enable
WORKDIR /misskey WORKDIR /misskey
COPY --link ["pnpm-lock.yaml", "pnpm-workspace.yaml", "package.json", "./"] COPY --link pnpm-lock.yaml ./
RUN --mount=type=cache,target=/root/.local/share/pnpm/store,sharing=locked \
pnpm fetch
COPY --link ["pnpm-workspace.yaml", "package.json", "./"]
COPY --link ["scripts", "./scripts"] COPY --link ["scripts", "./scripts"]
COPY --link ["packages/backend/package.json", "./packages/backend/"] COPY --link ["packages/backend/package.json", "./packages/backend/"]
RUN --mount=type=cache,target=/root/.local/share/pnpm/store,sharing=locked \ RUN pnpm i --frozen-lockfile --aggregate-output --offline
pnpm i --frozen-lockfile --aggregate-output
FROM --platform=$TARGETPLATFORM node:${NODE_VERSION}-slim AS runner FROM --platform=$TARGETPLATFORM node:${NODE_VERSION}-slim AS runner