Skip to content

Commit

Permalink
ci fixup
Browse files Browse the repository at this point in the history
  • Loading branch information
bschimke95 committed Jun 28, 2024
1 parent 487e0b4 commit d4d6830
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,17 @@ WORKDIR /workspace
# Run this with docker build --build-arg goproxy=$(go env GOPROXY) to override the goproxy
ARG goproxy=https://proxy.golang.org
# Run this with docker build --build-arg package=./controlplane/kubeadm or --build-arg package=./bootstrap/kubeadm
ENV GOPROXY=$goproxy
ENV GOPROXY=direct

# 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 --mount=type=cache,target=/go/pkg/mod \
go mod download

# Copy the sources
COPY ./ ./

Expand All @@ -45,7 +50,10 @@ ARG package=.
ARG ARCH
ARG ldflags

Run CGO_ENABLED=0 GOOS=linux GOARCH=${ARCH} \
# Do not force rebuild of up-to-date packages (do not use -a) and use the compiler cache folder
RUN --mount=type=cache,target=/root/.cache/go-build \
--mount=type=cache,target=/go/pkg/mod \
CGO_ENABLED=0 GOOS=linux GOARCH=${ARCH} \
go build -trimpath -ldflags "${ldflags} -extldflags '-static'" \
-o manager ${package}

Expand Down

0 comments on commit d4d6830

Please sign in to comment.