Featured image of post Dockerfile Collection

Dockerfile Collection

Dockerfile Collection

Nextjs with pnpm

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
FROM node:20-slim AS base
ENV PNPM_HOME="/pnpm"
ENV NODE_ENV=production
ENV PATH="$PNPM_HOME:$PATH"

RUN corepack enable
COPY . /app
WORKDIR /app

FROM base AS prod-deps
RUN id=pnpm,target=/pnpm/store pnpm install --prod --frozen-lockfile
# RUN --mount=type=cache,id=pnpm,target=/pnpm/store pnpm install --prod --frozen-lockfile

FROM base AS build
RUN id=pnpm,target=/pnpm/store pnpm install --frozen-lockfile && pnpm run 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/.next /app/.next

EXPOSE 3000
CMD [ "pnpm", "start"]

modified from https://pnpm.io/docker

好想養貓阿~~
使用 Hugo 建立
主題 StackJimmy 設計