barycenter/Dockerfile
Till Wegmueller c8b27bf196
feat: add deployment configurations for multiple platforms
Add comprehensive deployment support for:
- Docker: Multi-stage Dockerfile with security hardening
- Docker Compose: Production-ready compose file with volume persistence
- Kubernetes: Complete Helm chart with configurable values, ingress, PVC
- Linux: systemd service unit with extensive security hardening
- FreeBSD: rc.d init script with proper daemon management
- illumos/Solaris: SMF manifest with service contract management

Each platform includes:
- Installation scripts/manifests
- Configuration examples
- Management instructions
- Security best practices
- Troubleshooting guides

The Helm chart provides:
- Configurable resources and autoscaling
- Security contexts and pod security
- Health checks (liveness/readiness probes)
- Ingress with TLS support
- Persistent volume claims
- Service account management

All deployments follow security best practices:
- Non-root user execution
- Minimal privileges
- Read-only root filesystems where applicable
- Resource limits
- Network policies

Added DEPLOYMENT.md with comprehensive deployment guide covering
all platforms, configuration options, and production checklist.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-29 15:30:46 +01:00

56 lines
1.3 KiB
Docker

# Multi-stage build for Barycenter OpenID Connect IdP
# Build stage
FROM rust:1.83-bookworm AS builder
WORKDIR /build
# Copy manifests
COPY Cargo.toml Cargo.lock ./
# Copy source code
COPY src ./src
# Build release binary
RUN --mount=type=cache,target=/usr/local/cargo/registry \
--mount=type=cache,target=/build/target \
cargo build --release && \
cp target/release/barycenter /barycenter
# Runtime stage
FROM debian:bookworm-slim
# Install runtime dependencies
RUN apt-get update && \
apt-get install -y --no-install-recommends \
ca-certificates \
&& rm -rf /var/lib/apt/lists/*
# Create non-root user
RUN useradd -r -u 1000 -s /bin/false barycenter && \
mkdir -p /app/data /app/config && \
chown -R barycenter:barycenter /app
WORKDIR /app
# Copy binary from builder
COPY --from=builder /barycenter /usr/local/bin/barycenter
# Copy default configuration
COPY config.toml /app/config/config.toml
# Set ownership
RUN chown -R barycenter:barycenter /app
# Switch to non-root user
USER barycenter
# Expose default port
EXPOSE 8080
# Health check
HEALTHCHECK --interval=30s --timeout=3s --start-period=5s --retries=3 \
CMD ["/bin/sh", "-c", "test -f /proc/self/exe || exit 1"]
# Default command
ENTRYPOINT ["/usr/local/bin/barycenter"]
CMD ["--config", "/app/config/config.toml"]