Skip to content

Commit

Permalink
Create Dockerfile (#191)
Browse files Browse the repository at this point in the history
  • Loading branch information
dffgdffghgfhfh authored Feb 5, 2025
1 parent 1c3eb58 commit 67b0355
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# 使用官方 Rust 镜像作为基础镜像
FROM rust:1.67 as builder

# 设置工作目录
WORKDIR /app

# 将当前目录下的代码复制到容器中
COPY . .

# 安装依赖并构建项目
RUN cargo build --release

# 使用官方 Debian 镜像作为运行时镜像
FROM debian:bullseye-slim

# 安装需要的运行时依赖 (如果有)
RUN apt-get update && apt-get install -y \
libssl-dev \
ca-certificates \
&& rm -rf /var/lib/apt/lists/*

# 将构建的二进制文件从构建镜像中复制到运行时镜像
COPY --from=builder /app/target/release/biliup-rs /usr/local/bin/biliup-rs

# 设置容器启动命令
ENTRYPOINT ["/usr/local/bin/biliup-rs"]

0 comments on commit 67b0355

Please sign in to comment.