# GitDataAI Backend - GitPod Service # Multi-stage build for Rust application # Stage 1: Build the application FROM rust:1.96-bookworm AS builder # Install system dependencies RUN apt-get update && apt-get install -y \ pkg-config \ libssl-dev \ libpq-dev \ cmake \ && rm -rf /var/lib/apt/lists/* # Create app directory WORKDIR /app # Copy workspace files COPY Cargo.toml Cargo.lock ./ COPY app/ app/ COPY lib/ lib/ # Build the application in release mode RUN cargo build --release --bin gitpod # Stage 2: Create runtime image FROM debian:bookworm-slim # Install runtime dependencies RUN apt-get update && apt-get install -y \ libssl3 \ libpq5 \ ca-certificates \ curl \ && rm -rf /var/lib/apt/lists/* # Create non-root user RUN useradd -r -s /bin/false appuser # Create directories RUN mkdir -p /app/data/repos \ /app/logs \ && chown -R appuser:appuser /app # Copy binary from builder COPY --from=builder /app/target/release/gitpod /app/gitpod # Set ownership RUN chown -R appuser:appuser /app # Switch to non-root user USER appuser # Set working directory WORKDIR /app # Expose port EXPOSE 5082 # Health check HEALTHCHECK --interval=30s --timeout=3s --start-period=5s --retries=3 \ CMD curl -f http://localhost:5082/health || exit 1 # Run the application CMD ["./gitpod"]