diff --git a/Dockerfile b/Dockerfile index 0c07adc9..f3e615ec 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,20 +1,21 @@ -FROM node:20-slim AS base -ENV PNPM_HOME="/pnpm" -ENV PATH="$PNPM_HOME:$PATH" +FROM node:20.10.0-alpine as BUILD -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 +COPY . . + +RUN npm install -g pnpm + +RUN pnpm install -FROM base AS build -RUN --mount=type=cache,id=pnpm,target=/pnpm/store pnpm install --frozen-lockfile RUN pnpm run build -FROM base -COPY --from=prod-deps /app/node_modules /app/node_modules -COPY --from=build /app/ . +FROM node:20.10.0-alpine + EXPOSE 3000 -CMD [ "pnpm", "start" ] + +WORKDIR /app + +COPY --from=BUILD /app/ . + +ENTRYPOINT ["pnpm", "run", "start"]