Skip to content

Commit 8b168ef

Browse files
committed
fix multiplatform container images
There were two cases where deletion of a claim was reconciled without calling ClaimHandler.ReleaseAddress, which causes issues for providers that manage addresses in external systems.
1 parent f0b646f commit 8b168ef

File tree

2 files changed

+9
-5
lines changed

2 files changed

+9
-5
lines changed

Dockerfile

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,15 @@
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
1414

15+
# global ARGs used in base images
1516
ARG ARCH
1617

1718
# Build the manager binary
18-
FROM golang:1.23 as builder
19+
FROM golang:1.23 AS builder
20+
21+
# builder ARGs. No inheritance from global ARGs, so we need to redeclare them.
22+
ARG ARCH
23+
ARG ldflags
1924

2025
WORKDIR /workspace
2126
# Copy the Go Modules manifests
@@ -32,13 +37,12 @@ COPY api/ api/
3237
COPY internal/ internal/
3338
COPY pkg/ pkg/
3439

35-
ARG ldflags
36-
3740
# Build
3841
RUN --mount=type=cache,target=/root/.cache/go-build \
3942
--mount=type=cache,target=/go/pkg/mod \
4043
CGO_ENABLED=0 GOOS=linux GOARCH=${ARCH} \
41-
go build -trimpath -ldflags "${ldflags}" -a -o manager main.go
44+
go build -trimpath -ldflags "${ldflags} -extldflags '-static'" \
45+
-o manager main.go
4246

4347
# Use distroless as minimal base image to package the manager binary
4448
# Refer to https://github.com/GoogleContainerTools/distroless for more details

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ run: manifests generate fmt vet ## Run a controller from your host.
103103

104104
.PHONY: docker-build
105105
docker-build: licenses-report ## Build docker image with the manager.
106-
ARCH=$(ARCH) docker build --build-arg ARCH=$(ARCH) -t $(STAGING_IMG)-$(ARCH):$(TAG) .
106+
DOCKER_BUILDKIT=1 docker build --build-arg ARCH=$(ARCH) -t $(STAGING_IMG)-$(ARCH):$(TAG) .
107107

108108
.PHONY: docker-build-all
109109
docker-build-all: $(addprefix docker-build-,$(ALL_ARCH))

0 commit comments

Comments
 (0)