Files
at-container-registry/Dockerfile
T
2025-10-02 11:03:59 -05:00

49 lines
952 B
Docker

# Build stage
FROM golang:1.24-alpine AS builder
# Install build dependencies
RUN apk add --no-cache git make
# 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
RUN CGO_ENABLED=0 GOOS=linux go build -a -installsuffix cgo -o atcr-registry ./cmd/registry
# Runtime stage
FROM alpine:latest
# Install CA certificates for HTTPS
RUN apk --no-cache add ca-certificates
# 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"]