# Simple runtime-only Dockerfile for pre-built binaries # Build binary first: cargo build --release -p api_gateway # Then: docker build -f services/api_gateway/Dockerfile.simple -t foxhunt-api . FROM debian:bookworm-slim # Install runtime dependencies RUN apt-get update && apt-get install -y \ ca-certificates \ libssl3 \ curl \ && rm -rf /var/lib/apt/lists/* # Download and install grpc_health_probe for health checks RUN curl -sSL https://github.com/grpc-ecosystem/grpc-health-probe/releases/download/v0.4.25/grpc_health_probe-linux-amd64 \ -o /usr/local/bin/grpc_health_probe && \ chmod +x /usr/local/bin/grpc_health_probe # Create non-root user RUN groupadd --system --gid 1000 foxhunt && \ useradd --system --uid 1000 --gid foxhunt --shell /bin/bash foxhunt # Create application directories RUN mkdir -p /app/config /app/logs && \ chown -R foxhunt:foxhunt /app # Set working directory WORKDIR /app # Copy pre-built binary from host COPY target/release/api_gateway ./api_gateway RUN chmod +x ./api_gateway && chown foxhunt:foxhunt ./api_gateway # Switch to non-root user USER foxhunt # Expose gRPC and metrics ports EXPOSE 50050 9091 # Health check using grpc_health_probe HEALTHCHECK --interval=10s --timeout=5s --start-period=30s --retries=3 \ CMD /usr/local/bin/grpc_health_probe -addr=localhost:50050 || exit 1 # Run the application ENTRYPOINT ["./api_gateway"]