4a87ea475d
- 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
23 lines
438 B
Docker
23 lines
438 B
Docker
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"]
|