729604f13b
- Add REPO_PREFIX_PATH environment variable support in Dockerfile and main.rs - Introduce GitksService struct with repo_prefix field to manage repository paths - Implement resolve and resolve_for_init methods for repository path handling - Add path traversal protection and validation for repository operations - Update all service implementations to use self.resolve instead of global resolve - Modify serve function to accept repo_prefix parameter and pass to GitksService - Remove global resolve functions and integrate them into GitksService struct - Add proper initialization of repo directory from environment variable
26 lines
497 B
Docker
26 lines
497 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
|
|
ENV REPO_PREFIX_PATH=/data/repos
|
|
|
|
RUN mkdir -p /data/repos
|
|
|
|
EXPOSE 50051
|
|
|
|
ENTRYPOINT ["gitks"]
|