# Build stage FROM golang:1.24-alpine AS builder # Install build dependencies (gcc and musl-dev needed for SQLite CGO) RUN apk add --no-cache git make gcc musl-dev sqlite-dev # Set working directory WORKDIR /build # Copy go mod files COPY go.mod go.sum ./ # Download dependencies RUN go mod download # Copy source code COPY . . # Build the binary with CGO enabled for SQLite support RUN CGO_ENABLED=1 GOOS=linux go build -a -o atcr-registry ./cmd/registry # Runtime stage FROM alpine:latest # Install CA certificates for HTTPS, SQLite runtime libraries, and sqlite CLI for debugging RUN apk --no-cache add ca-certificates sqlite-libs sqlite # Set working directory WORKDIR /app # Copy binary from builder COPY --from=builder /build/atcr-registry . # Copy default configuration COPY config/config.yml /etc/atcr/config.yml # Create directories for storage RUN mkdir -p /var/lib/atcr/blobs /var/lib/atcr/auth # Expose ports EXPOSE 5000 5001 # Set environment variables ENV ATCR_CONFIG=/etc/atcr/config.yml # Run the registry ENTRYPOINT ["/app/atcr-registry"] CMD ["serve", "/etc/atcr/config.yml"]