Skip to content

Commit 2d41f48

Browse files
committed
fix: update Dockerfile for tsdown bundled build
- Use node:22-alpine base image - Copy tsdown.config.ts in builder stage - Runner stage only copies dist/ (no node_modules needed) - Replace yarn start:prod with node dist/server.js
1 parent 26461f9 commit 2d41f48

1 file changed

Lines changed: 9 additions & 13 deletions

File tree

Dockerfile

Lines changed: 9 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,27 @@
1-
FROM jellydn/alpine-nodejs:20 as builder
2-
# Build the image
3-
RUN mkdir /app
1+
FROM node:22-alpine AS builder
42
WORKDIR /app
53

64
RUN apk upgrade --no-cache -U && \
75
apk add --no-cache git
86

9-
COPY package.json pnpm-lock.yaml tsconfig.json ./
7+
RUN npm i -g pnpm
8+
9+
COPY package.json pnpm-lock.yaml tsconfig.json tsdown.config.ts ./
1010
COPY src src
1111
COPY packages packages
1212
COPY app.config.ts app.config.ts
1313

14-
RUN npm i -g pnpm
1514
RUN pnpm install --frozen-lockfile --prefer-frozen-lockfile
16-
ENV NODE_ENV=production
1715
RUN npm run build
1816

19-
# Copy the build output
20-
FROM jellydn/alpine-nodejs:20
17+
FROM node:22-alpine
2118
WORKDIR /app
22-
COPY --from=builder /app .
2319

24-
RUN npm i -g pnpm
2520
ENV NODE_ENV=production
2621
ENV TZ=Asia/Shanghai
27-
RUN pnpm install --frozen-lockfile --prefer-frozen-lockfile
28-
# Export 8888 for health check with fly.io
22+
23+
COPY --from=builder /app/dist dist
24+
2925
EXPOSE 8888
3026
EXPOSE 8080
31-
CMD ["yarn", "start:prod"]
27+
CMD ["node", "dist/server.js"]

0 commit comments

Comments
 (0)