k2a / Dockerfile
StarrySkyWorld's picture
Update Dockerfile
86c31f9 verified
# 构建阶段 - 使用最新 Rust 版本
FROM rust:1.85-bookworm AS builder
# 安装 Node.js 用于构建前端
RUN curl -fsSL https://deb.nodesource.com/setup_20.x | bash - \
&& apt-get install -y nodejs
WORKDIR /app
# 克隆项目
RUN git clone https://github.com/AmethystDev-Labs/kiro.rs.git .
# 构建前端
RUN cd admin-ui && npm install && npm run build
# 构建 Rust 项目
RUN cargo build --release
# 运行阶段
FROM debian:bookworm-slim
RUN apt-get update && apt-get install -y \
ca-certificates \
libssl3 \
&& rm -rf /var/lib/apt/lists/*
WORKDIR /app
# 从构建阶段复制二进制文件
COPY --from=builder /app/target/release/kiro-rs .
COPY --from=builder /app/admin-ui/dist ./admin-ui/dist
# 复制配置文件
COPY config.json .
# HF Spaces 要求监听 7860 端口
EXPOSE 7860
# 启动命令
CMD ["./kiro-rs", "-c", "/app/config.json"]