Skip to content

Commit 4df4a0c

Browse files
committed
try fix docker. build
1 parent 56e8ae8 commit 4df4a0c

2 files changed

Lines changed: 18 additions & 8 deletions

File tree

.dockerignore

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
node_modules
2+
.git
3+
.gitignore
4+
*.md
5+
dist

Dockerfile

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,17 @@
1-
FROM node:20 AS builder
1+
FROM node:20-slim AS base
2+
ENV PNPM_HOME="/pnpm"
3+
ENV PATH="$PNPM_HOME:$PATH"
4+
RUN corepack enable
5+
COPY . /app
26
WORKDIR /app
37

4-
COPY package*.json ./
5-
RUN pnpm install
8+
FROM base AS prod-deps
9+
RUN --mount=type=cache,id=pnpm,target=/pnpm/store pnpm install --prod --frozen-lockfile
610

7-
COPY . .
8-
RUN pnpm run build # produces /app/dist
11+
FROM base AS build
12+
RUN --mount=type=cache,id=pnpm,target=/pnpm/store pnpm install --frozen-lockfile
13+
RUN pnpm run build
914

10-
FROM alpine:latest
11-
WORKDIR /site
12-
COPY --from=builder /app/dist ./
15+
FROM base
16+
COPY --from=prod-deps /app/node_modules /app/node_modules
17+
COPY --from=build /app/dist /app/dist

0 commit comments

Comments
 (0)