forked from reactive-tech/kubegres
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Improve build to allow local cross platform builds (#16)
* Improve build to allow local cross platform builds * fix make docker-build * install go in the scan CI check * update go to fix CVE-2024-24791 * update controller tools
- Loading branch information
1 parent
b515325
commit 62adea8
Showing
5 changed files
with
26 additions
and
41 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
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
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 |
---|---|---|
@@ -1,41 +1,14 @@ | ||
# Build the manager binary | ||
FROM golang:1.22 as builder | ||
|
||
ARG TARGETPLATFORM | ||
ARG BUILDPLATFORM | ||
|
||
WORKDIR /workspace | ||
# Copy the Go Modules manifests | ||
COPY go.mod go.mod | ||
COPY go.sum go.sum | ||
# cache deps before building and copying source so that we don't need to re-download as much | ||
# and so that source changes don't invalidate our downloaded layer | ||
RUN go mod download | ||
|
||
# Copy the go source | ||
COPY main.go main.go | ||
COPY api/ api/ | ||
COPY controllers/ controllers/ | ||
|
||
# Build | ||
ENV CGO_ENABLED=0 \ | ||
GO111MODULE=on | ||
|
||
SHELL ["/bin/bash", "-o", "pipefail", "-c"] | ||
RUN \ | ||
export GOOS \ | ||
&& GOOS=$(echo ${TARGETPLATFORM} | cut -d / -f1) \ | ||
&& export GOARCH \ | ||
&& GOARCH=$(echo ${TARGETPLATFORM} | cut -d / -f2) \ | ||
&& export GOARM \ | ||
&& GOARM=$(echo ${TARGETPLATFORM} | cut -d / -f3 | cut -c2-) \ | ||
&& go build -a -o manager main.go | ||
## Build the manager binary | ||
|
||
# Use distroless as minimal base image to package the manager binary | ||
# Refer to https://github.com/GoogleContainerTools/distroless for more details | ||
FROM gcr.io/distroless/static:nonroot | ||
|
||
ARG TARGETOS | ||
ARG TARGETARCH | ||
|
||
WORKDIR / | ||
COPY --from=builder /workspace/manager . | ||
COPY build/bin/manager-${TARGETOS}-${TARGETARCH} manager | ||
USER 65532:65532 | ||
|
||
ENTRYPOINT ["/manager"] |
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
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 |
---|---|---|
@@ -1,6 +1,6 @@ | ||
module reactive-tech.io/kubegres | ||
|
||
go 1.22.4 | ||
go 1.22.5 | ||
|
||
require ( | ||
github.com/go-logr/logr v1.2.3 | ||
|