Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit dacec9c

Browse files
committed
feat: add Dockerfile
Signed-off-by: 诺墨 <[email protected]>
1 parent 05723f8 commit dacec9c

File tree

1 file changed

+26
-0
lines changed

1 file changed

+26
-0
lines changed

Dockerfile

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
FROM node:22.12-alpine AS builder
2+
3+
# 复制项目文件
4+
COPY src/gitee /app
5+
COPY tsconfig.json /tsconfig.json
6+
7+
WORKDIR /app
8+
9+
# 安装依赖并构建
10+
RUN --mount=type=cache,target=/root/.npm npm install
11+
12+
FROM node:22.12-alpine AS release
13+
14+
# 从构建阶段复制必要文件
15+
COPY --from=builder /app/dist /app/dist
16+
COPY --from=builder /app/package.json /app/package.json
17+
COPY --from=builder /app/package-lock.json /app/package-lock.json
18+
19+
ENV NODE_ENV=production
20+
21+
WORKDIR /app
22+
23+
# 安装生产依赖
24+
RUN npm ci --ignore-scripts --omit=dev
25+
26+
ENTRYPOINT ["node", "dist/bin.js"]

0 commit comments

Comments
 (0)