StarrySkyWorld commited on
Commit
7cc88aa
·
verified ·
1 Parent(s): ae99a01

Create Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +40 -0
Dockerfile ADDED
@@ -0,0 +1,40 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # 构建阶段
2
+ FROM rust:1.75-bookworm AS builder
3
+
4
+ # 安装 Node.js 用于构建前端
5
+ RUN curl -fsSL https://deb.nodesource.com/setup_20.x | bash - \
6
+ && apt-get install -y nodejs
7
+
8
+ WORKDIR /app
9
+
10
+ # 克隆项目(或者你可以 COPY 本地代码)
11
+ RUN git clone https://github.com/AmethystDev-Labs/kiro-rs.git .
12
+
13
+ # 构建前端
14
+ RUN cd admin-ui && npm install && npm run build
15
+
16
+ # 构建 Rust 项目
17
+ RUN cargo build --release
18
+
19
+ # 运行阶段
20
+ FROM debian:bookworm-slim
21
+
22
+ RUN apt-get update && apt-get install -y \
23
+ ca-certificates \
24
+ libssl3 \
25
+ && rm -rf /var/lib/apt/lists/*
26
+
27
+ WORKDIR /app
28
+
29
+ # 从构建阶段复制二进制文件
30
+ COPY --from=builder /app/target/release/kiro-rs .
31
+ COPY --from=builder /app/admin-ui/dist ./admin-ui/dist
32
+
33
+ # 复制配置文件
34
+ COPY config.json .
35
+
36
+ # HF Spaces 要求监听 7860 端口
37
+ EXPOSE 7860
38
+
39
+ # 启动命令
40
+ CMD ["./kiro-rs", "-c", "/app/config.json"]