Skip to content

Commit 8f4f8f6

Browse files
committed
Docker registry URL configurable
Because sometimes Docker rate limits, and you need a workaround/proxy
1 parent ff7a10d commit 8f4f8f6

File tree

2 files changed

+8
-5
lines changed

2 files changed

+8
-5
lines changed

Dockerfile

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
ARG GO_TAG=1.24
2+
ARG DOCKER_REGISTRY=docker.io
23
# Build the manager binary
3-
FROM --platform=$BUILDPLATFORM golang:${GO_TAG} AS builder
4+
FROM --platform=$BUILDPLATFORM ${DOCKER_REGISTRY}/library/golang:${GO_TAG} AS builder
45

56
WORKDIR /workspace
67

@@ -29,7 +30,9 @@ ENV GOFIPS140=$FIPS_MODE
2930
RUN CGO_ENABLED=0 GO111MODULE=on go build -a -tags timetzdata -o manager main.go
3031

3132
# ---------------------------------------
32-
FROM alpine:latest AS etc-builder
33+
ARG DOCKER_REGISTRY=docker.io
34+
FROM ${DOCKER_REGISTRY}/library/alpine:latest AS etc-builder
35+
3336

3437
RUN echo "rabbitmq-cluster-operator:x:1000:" > /etc/group && \
3538
echo "rabbitmq-cluster-operator:x:1000:1000::/home/rabbitmq-cluster-operator:/usr/sbin/nologin" > /etc/passwd

Makefile

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,7 @@ GIT_COMMIT := $(shell git rev-parse --short HEAD)
181181
deploy-kind: manifests deploy-namespace-rbac ## Load operator image and deploy operator into current KinD cluster
182182
@$(call check_defined, OPERATOR_IMAGE, path to the Operator image within the registry e.g. rabbitmq/cluster-operator)
183183
@$(call check_defined, DOCKER_REGISTRY_SERVER, URL of docker registry containing the Operator image e.g. registry.my-company.com)
184-
docker buildx build --build-arg=GIT_COMMIT=$(GIT_COMMIT) -t $(DOCKER_REGISTRY_SERVER)/$(OPERATOR_IMAGE):$(GIT_COMMIT) .
184+
docker buildx build --build-arg=DOCKER_REGISTRY=$(DOCKER_REGISTRY_SERVER) --build-arg=GIT_COMMIT=$(GIT_COMMIT) -t $(DOCKER_REGISTRY_SERVER)/$(OPERATOR_IMAGE):$(GIT_COMMIT) .
185185
kind load docker-image $(DOCKER_REGISTRY_SERVER)/$(OPERATOR_IMAGE):$(GIT_COMMIT)
186186
kustomize build config/crd | kubectl apply -f -
187187
kustomize build config/default/overlays/kind | sed 's@((operator_docker_image))@"$(DOCKER_REGISTRY_SERVER)/$(OPERATOR_IMAGE):$(GIT_COMMIT)"@' | kubectl apply -f -
@@ -205,7 +205,7 @@ generate-installation-manifest: | $(YTT)
205205
docker-build: ## Build the docker image with tag `latest`
206206
@$(call check_defined, OPERATOR_IMAGE, path to the Operator image within the registry e.g. rabbitmq/cluster-operator)
207207
@$(call check_defined, DOCKER_REGISTRY_SERVER, URL of docker registry containing the Operator image e.g. registry.my-company.com)
208-
docker buildx build --build-arg=GIT_COMMIT=$(GIT_COMMIT) -t $(DOCKER_REGISTRY_SERVER)/$(OPERATOR_IMAGE):latest .
208+
docker buildx build --build-arg=DOCKER_REGISTRY=$(DOCKER_REGISTRY_SERVER) --build-arg=GIT_COMMIT=$(GIT_COMMIT) -t $(DOCKER_REGISTRY_SERVER)/$(OPERATOR_IMAGE):latest .
209209

210210
docker-push: ## Push the docker image with tag `latest`
211211
@$(call check_defined, OPERATOR_IMAGE, path to the Operator image within the registry e.g. rabbitmq/cluster-operator)
@@ -215,7 +215,7 @@ docker-push: ## Push the docker image with tag `latest`
215215
docker-build-dev:
216216
@$(call check_defined, OPERATOR_IMAGE, path to the Operator image within the registry e.g. rabbitmq/cluster-operator)
217217
@$(call check_defined, DOCKER_REGISTRY_SERVER, URL of docker registry containing the Operator image e.g. registry.my-company.com)
218-
docker buildx build --build-arg=GIT_COMMIT=$(GIT_COMMIT) -t $(DOCKER_REGISTRY_SERVER)/$(OPERATOR_IMAGE):$(GIT_COMMIT) .
218+
docker buildx build --build-arg=DOCKER_REGISTRY=$(DOCKER_REGISTRY_SERVER) --build-arg=GIT_COMMIT=$(GIT_COMMIT) -t $(DOCKER_REGISTRY_SERVER)/$(OPERATOR_IMAGE):$(GIT_COMMIT) .
219219
docker push $(DOCKER_REGISTRY_SERVER)/$(OPERATOR_IMAGE):$(GIT_COMMIT)
220220

221221
# https://github.com/cert-manager/cmctl/releases

0 commit comments

Comments
 (0)