# Synor Testnet Faucet Dockerfile # Multi-stage build for minimal production image # ============================================================================= # Stage 1: Build Environment # ============================================================================= FROM rust:1.85-bookworm AS builder # Install build dependencies RUN apt-get update && apt-get install -y \ cmake \ clang \ libclang-dev \ pkg-config \ libssl-dev \ && rm -rf /var/lib/apt/lists/* # Create app directory WORKDIR /app # Copy manifests first (for better caching) COPY Cargo.toml Cargo.lock ./ COPY src/ src/ COPY crates/ crates/ COPY apps/ apps/ # Build release binary RUN cargo build --release --bin synor-faucet # ============================================================================= # Stage 2: Runtime Environment # ============================================================================= FROM debian:bookworm-slim AS runtime # Install runtime dependencies RUN apt-get update && apt-get install -y \ ca-certificates \ libssl3 \ curl \ && rm -rf /var/lib/apt/lists/* # Create non-root user for security RUN useradd --create-home --shell /bin/bash faucet # Copy binary from builder COPY --from=builder /app/target/release/synor-faucet /usr/local/bin/synor-faucet # Switch to non-root user USER faucet # Set working directory WORKDIR /home/faucet # Expose HTTP port EXPOSE 8080 # Health check HEALTHCHECK --interval=30s --timeout=10s --start-period=10s --retries=3 \ CMD curl -f http://localhost:8080/health || exit 1 # Environment variables with defaults ENV SYNOR_RPC_URL=http://localhost:17110 ENV FAUCET_AMOUNT=1000000000 ENV FAUCET_COOLDOWN=3600 ENV FAUCET_LISTEN_ADDR=0.0.0.0:8080 ENV RUST_LOG=info # Default command ENTRYPOINT ["synor-faucet"]