-
Notifications
You must be signed in to change notification settings - Fork 13
Expand file tree
/
Copy pathContainerfile.download
More file actions
34 lines (22 loc) · 972 Bytes
/
Containerfile.download
File metadata and controls
34 lines (22 loc) · 972 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
27
28
29
30
31
32
33
34
# 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-binaries && \
rm -rf /root/.cache/go-build /tmp/*
# 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
# Copy binaries, checksums, and LICENSE
COPY --from=builder /app/release-binaries /archives
# Copy the download server
COPY --from=builder /app/download-server /usr/local/bin/download-server
EXPOSE 8080
CMD ["/usr/local/bin/download-server"]