From 4a87ea475dbc46f0c1957e138735e7807e8f8c2a Mon Sep 17 00:00:00 2001 From: zhenyi <434836402@qq.com> Date: Thu, 4 Jun 2026 14:11:55 +0800 Subject: [PATCH] feat(build): add Docker support for gitks application - Add .dockerignore file to exclude unnecessary files from Docker build context - Create multi-stage Dockerfile with rust builder and debian runtime stages - Configure environment variables for host and port settings - Set up proper EXPOSE and ENTRYPOINT instructions - Optimize build with cargo release and binary stripping - Install only required dependencies in production stage --- .dockerignore | 6 ++++++ Dockerfile | 22 ++++++++++++++++++++++ 2 files changed, 28 insertions(+) create mode 100644 .dockerignore create mode 100644 Dockerfile diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..e846d1b --- /dev/null +++ b/.dockerignore @@ -0,0 +1,6 @@ +target +.git +.idea +*.md +LICENSE +.env diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..a77af5f --- /dev/null +++ b/Dockerfile @@ -0,0 +1,22 @@ +FROM rust:1.96-bookworm AS builder + +WORKDIR /app +COPY . . + +RUN cargo build --release --bin gitks && \ + strip target/release/gitks + +FROM debian:bookworm-slim + +RUN apt-get update && \ + apt-get install -y --no-install-recommends git ca-certificates && \ + rm -rf /var/lib/apt/lists/* + +COPY --from=builder /app/target/release/gitks /usr/local/bin/gitks + +ENV GITKS_HOST=0.0.0.0 +ENV GITKS_PORT=50051 + +EXPOSE 50051 + +ENTRYPOINT ["gitks"]