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
This commit is contained in:
zhenyi
2026-06-04 14:11:55 +08:00
parent f0a443932a
commit 4a87ea475d
2 changed files with 28 additions and 0 deletions
+6
View File
@@ -0,0 +1,6 @@
target
.git
.idea
*.md
LICENSE
.env
+22
View File
@@ -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"]