diff --git a/infra/docker/Dockerfile b/infra/docker/Dockerfile index a3feda49..9c1508da 100644 --- a/infra/docker/Dockerfile +++ b/infra/docker/Dockerfile @@ -10,8 +10,6 @@ RUN --mount=type=cache,target=/var/cache/apt,sharing=locked \ && apt-get install -yqq --no-install-recommends \ python3 -RUN corepack enable - WORKDIR /jetdisc COPY --link ["pnpm-lock.yaml", "package.json", "./"] @@ -24,6 +22,14 @@ COPY --link . ./ ARG NODE_ENV=production RUN pnpm build +# ビルド成果物だけど取り扱うレイヤ +FROM node:${NODE_VERSION} AS node-lib + +WORKDIR /jetdisc + +COPY --link ["pnpm-lock.yaml", "package.json", "./"] +RUN pnpm i --frozen-lockfile --prod + FROM node:${NODE_VERSION}-slim AS runner ARG UID="991" @@ -43,7 +49,7 @@ RUN apt-get update \ USER jetdisc WORKDIR /jetdisc -COPY --chown=jetdisc:jetdisc --from=builder /jetdisc/node_modules ./node_modules +COPY --chown=jetdisc:node-lib --from=builder /jetdisc/node_modules ./node_modules COPY --chown=jetdisc:jetdisc --from=builder /jetdisc/built ./built COPY --chown=jetdisc:jetdisc . ./