forked from kubernetes-sigs/cluster-api-provider-kubevirt
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #63 from rokej/patch-1
Create Dockerfile.rhtap
- Loading branch information
Showing
1 changed file
with
26 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
FROM brew.registry.redhat.io/rh-osbs/openshift-golang-builder:rhel_9_1.22 as builder | ||
|
||
# Run this with docker build --build_arg $(go env GOPROXY) to override the goproxy | ||
ARG goproxy=https://proxy.golang.org | ||
ENV GOPROXY=$goproxy | ||
ENV GOFLAGS="-mod=readonly" | ||
|
||
WORKDIR /workspace | ||
|
||
# Copy the sources | ||
COPY ./ ./ | ||
RUN go mod download | ||
|
||
# Build | ||
ARG package=. | ||
ARG ARCH | ||
ARG LDFLAGS | ||
RUN CGO_ENABLED=0 GOOS=linux GOARCH=${ARCH} go build -ldflags "${LDFLAGS} -extldflags '-static'" -o manager ${package} | ||
|
||
# Copy the controller-manager into a thin image | ||
FROM registry.redhat.io/rhel9-4-els/rhel:9.4 | ||
WORKDIR / | ||
COPY --from=builder /workspace/manager . | ||
# Use uid of nonroot user (65532) because kubernetes expects numeric user when applying pod security policies | ||
USER 65532 | ||
ENTRYPOINT ["/manager"] |