-
Notifications
You must be signed in to change notification settings - Fork 13
Expand file tree
/
Copy pathContainerfile.download
More file actions
36 lines (24 loc) · 1.04 KB
/
Containerfile.download
File metadata and controls
36 lines (24 loc) · 1.04 KB
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
27
28
29
30
31
32
33
34
35
36
# This Dockerfile is used to cross-build the kubectl-oadp binaries for all platforms
# It also builds a Go server that serves the built binaries
FROM --platform=$BUILDPLATFORM golang:1.25 AS builder
ARG TARGETOS
ARG TARGETARCH
WORKDIR /app
COPY go.mod go.sum ./
RUN go mod download && go mod verify
COPY . .
RUN make release-archives && \
mkdir -p /archives && \
mv *.tar.gz *.sha256 /archives/ && \
rm -rf /root/.cache/go-build /tmp/* release-build/
# Build the download server for the TARGET platform (the arch this container will run on)
RUN CGO_ENABLED=0 GOOS=${TARGETOS} GOARCH=${TARGETARCH} go build -o download-server ./cmd/downloads/ && \
go clean -cache -modcache -testcache && \
rm -rf /root/.cache/go-build /go/pkg
FROM registry.access.redhat.com/ubi9/ubi-minimal:latest
# Only copy compressed tarballs (much smaller than raw binaries)
COPY --from=builder /archives /archives
# Copy the download server
COPY --from=builder /app/download-server /usr/local/bin/download-server
EXPOSE 8080
CMD ["/usr/local/bin/download-server"]