From ec96342a692245b07c9bb99cf28d6f7659204f2f Mon Sep 17 00:00:00 2001 From: Niklas Marion Date: Fri, 11 Oct 2024 14:41:23 +0200 Subject: [PATCH] fix --- Dockerfile | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/Dockerfile b/Dockerfile index e322a42..e3119aa 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,18 +1,19 @@ -FROM node:20-bookworm-slim AS base +FROM node:20-slim AS base ENV PNPM_HOME="/pnpm" ENV PATH="$PNPM_HOME:$PATH" RUN corepack enable +COPY . /app +WORKDIR /app + +FROM base AS prod-deps +RUN --mount=type=cache,id=pnpm,target=/pnpm/store pnpm install --prod --frozen-lockfile FROM base AS build -COPY . /usr/src/app -WORKDIR /usr/src/app -RUN --mount=type=cache,id=pnpm,target=/pnpm/store pnpm install -RUN pnpm build +RUN --mount=type=cache,id=pnpm,target=/pnpm/store pnpm install --frozen-lockfile +RUN pnpm run build FROM base -COPY --from=build /usr/src/app/package.json /usr/src/app/ -COPY --from=build /usr/src/app/server.js /usr/src/app/ -COPY --from=build /usr/src/app/build /usr/src/app/ -WORKDIR /usr/src/app/ +COPY --from=prod-deps /app/node_modules /app/node_modules +COPY --from=build /app/build /app/build EXPOSE 3000 CMD [ "pnpm", "start" ] \ No newline at end of file