forked from psviderski/unregistry
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
26 lines (18 loc) · 911 Bytes
/
Dockerfile
File metadata and controls
26 lines (18 loc) · 911 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
ARG ALPINE_VERSION=3.22.0
# Cross-compile unregistry for multiple architectures to speed up the build process on GitHub Actions.
FROM --platform=$BUILDPLATFORM golang:1.24-alpine AS builder
ARG TARGETOS
ARG TARGETARCH
WORKDIR /build
# Download and cache dependencies and only redownload them in subsequent builds if they change.
COPY go.mod go.sum ./
RUN go mod download && go mod verify
COPY . .
RUN GOOS=${TARGETOS} GOARCH=${TARGETARCH} go build -o unregistry ./cmd/unregistry
# Create a minimal image with the static binary built in the builder stage.
FROM alpine:${ALPINE_VERSION}
COPY --from=builder /build/unregistry /usr/local/bin/
EXPOSE 5000
# Run as root user by default to allow access to the containerd socket. This in unfortunate as running as non-root user
# requires changing the containerd socket permissions which still can be manually done by advanced users.
ENTRYPOINT ["unregistry"]