# 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-appview ./cmd/appview # 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-appview . # 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 # OCI image annotations LABEL org.opencontainers.image.title="ATCR AppView" \ org.opencontainers.image.description="ATProto Container Registry - OCI-compliant registry using AT Protocol for manifest storage" \ org.opencontainers.image.authors="ATCR Contributors" \ org.opencontainers.image.source="https://github.com/example/atcr" \ org.opencontainers.image.documentation="https://atcr.io/docs" \ org.opencontainers.image.licenses="MIT" \ org.opencontainers.image.version="0.1.0" \ io.atcr.icon="https://atcr.io/images/appview-icon.png" # Run the AppView ENTRYPOINT ["/app/atcr-appview"] CMD ["serve", "/etc/atcr/config.yml"]