@@ -71,7 +71,7 @@ RUN protoc -I/src/app/metal-controller-manager/internal/api \
7171 --go_out=paths=source_relative:/src/app/metal-controller-manager/internal/api --go-grpc_out=paths=source_relative:/src/app/metal-controller-manager/internal/api \
7272 api.proto
7373RUN --mount=type=cache,target=/.cache controller-gen object:headerFile="./hack/boilerplate.go.txt" paths="./..."
74- RUN --mount=type=cache,target=/.cache conversion-gen --input-dirs="./app/cluster-api-provider-sidero/api/v1alpha2" --output-base ./ --output-file-base="zz_generated.conversion" --go-header-file="./hack/boilerplate.go.txt"
74+ RUN --mount=type=cache,target=/.cache conversion-gen --input-dirs="./app/cluster-api-provider-sidero/api/v1alpha2" --output-base ./ --output-file-base="zz_generated.conversion" --go-header-file="./hack/boilerplate.go.txt"
7575ARG MODULE
7676RUN --mount=type=cache,target=/.cache gofumports -w -local ${MODULE} .
7777
@@ -108,7 +108,8 @@ COPY --from=release-build /cluster-template.yaml /infrastructure-sidero/${TAG}/c
108108
109109FROM base AS build-cluster-api-provider-sidero
110110ARG TARGETARCH
111- RUN --mount=type=cache,target=/.cache GOOS=linux GOARCH=${TARGETARCH} go build -ldflags "-s -w" -o /manager ./app/cluster-api-provider-sidero
111+ ARG GO_BUILDFLAGS
112+ RUN --mount=type=cache,target=/.cache GOOS=linux GOARCH=${TARGETARCH} go build ${GO_BUILDFLAGS} -ldflags "-s -w" -o /manager ./app/cluster-api-provider-sidero
112113RUN chmod +x /manager
113114
114115# # TODO(rsmitty): make bmc pkg and move to talos-systems image
@@ -124,15 +125,18 @@ ENTRYPOINT [ "/manager" ]
124125
125126FROM base AS build-metal-controller-manager
126127ARG TARGETARCH
127- RUN --mount=type=cache,target=/.cache GOOS=linux GOARCH=${TARGETARCH} go build -ldflags "-s -w" -o /manager ./app/metal-controller-manager
128+ ARG GO_BUILDFLAGS
129+ RUN --mount=type=cache,target=/.cache GOOS=linux GOARCH=${TARGETARCH} go build ${GO_BUILDFLAGS} -ldflags "-s -w" -o /manager ./app/metal-controller-manager
128130RUN chmod +x /manager
129131
130132FROM base AS agent-build-amd64
131- RUN --mount=type=cache,target=/.cache GOOS=linux GOARCH=amd64 go build -ldflags "-s -w" -o /agent ./app/metal-controller-manager/cmd/agent
133+ ARG GO_BUILDFLAGS
134+ RUN --mount=type=cache,target=/.cache GOOS=linux GOARCH=amd64 go build ${GO_BUILDFLAGS} -ldflags "-s -w" -o /agent ./app/metal-controller-manager/cmd/agent
132135RUN chmod +x /agent
133136
134137FROM base AS agent-build-arm64
135- RUN --mount=type=cache,target=/.cache GOOS=linux GOARCH=arm64 go build -ldflags "-s -w" -o /agent ./app/metal-controller-manager/cmd/agent
138+ ARG GO_BUILDFLAGS
139+ RUN --mount=type=cache,target=/.cache GOOS=linux GOARCH=arm64 go build ${GO_BUILDFLAGS} -ldflags "-s -w" -o /agent ./app/metal-controller-manager/cmd/agent
136140RUN chmod +x /agent
137141
138142FROM base AS initramfs-archive-amd64
@@ -179,7 +183,8 @@ ENTRYPOINT [ "/manager" ]
179183
180184FROM base AS build-metal-metadata-server
181185ARG TARGETARCH
182- RUN --mount=type=cache,target=/.cache GOOS=linux GOARCH=${TARGETARCH} go build -ldflags "-s -w" -o /metal-metadata-server ./app/metal-metadata-server
186+ ARG GO_BUILDFLAGS
187+ RUN --mount=type=cache,target=/.cache GOOS=linux GOARCH=${TARGETARCH} go build ${GO_BUILDFLAGS} -ldflags "-s -w" -o /metal-metadata-server ./app/metal-metadata-server
183188RUN chmod +x /metal-metadata-server
184189
185190FROM scratch AS metal-metadata-server
@@ -255,7 +260,8 @@ FROM sfyra-base AS sfyra-build
255260WORKDIR /src/sfyra/cmd/sfyra
256261ARG TALOS_RELEASE
257262ARG SFYRA_CMD_PKG=github.com/talos-systems/sidero/sfyra/cmd/sfyra/cmd
258- RUN --mount=type=cache,target=/.cache GOOS=linux go build -ldflags "-s -w -X ${SFYRA_CMD_PKG}.TalosRelease=${TALOS_RELEASE}" -o /sfyra
263+ ARG GO_BUILDFLAGS
264+ RUN --mount=type=cache,target=/.cache GOOS=linux go build ${GO_BUILDFLAGS} -ldflags "-s -w -X ${SFYRA_CMD_PKG}.TalosRelease=${TALOS_RELEASE}" -o /sfyra
259265RUN chmod +x /sfyra
260266
261267FROM scratch AS sfyra
0 commit comments