From ea0b4d2349d0104f012accdc33ce2b8979654957 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=BA=91=E6=B8=B8=E5=90=9B?= Date: Mon, 28 Oct 2024 20:26:25 +0800 Subject: [PATCH] feat: add Dockerfile (#124) --- Dockerfile | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 Dockerfile diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..13e6b85 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,22 @@ +FROM node:20-alpine as build-stage + +WORKDIR /app +RUN corepack enable + +COPY .npmrc package.json pnpm-lock.yaml ./ +RUN --mount=type=cache,id=pnpm-store,target=/root/.pnpm-store \ + pnpm install --frozen-lockfile + +COPY . . +RUN pnpm build + +# SSR +FROM node:20-alpine as production-stage + +WORKDIR /app + +COPY --from=build-stage /app/.output ./.output + +EXPOSE 3000 + +CMD ["node", ".output/server/index.mjs"]