forked from migtools/oadp-cli
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathContainerfile.download
More file actions
38 lines (25 loc) · 1.03 KB
/
Containerfile.download
File metadata and controls
38 lines (25 loc) · 1.03 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
37
38
# 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 /archives/
# 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/server.go
# Clean up to reduce layer size
RUN go clean -cache -modcache -testcache && \
rm -rf /root/.cache/go-build && \
rm -rf /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"]