Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Golang image path customization in dockerfile to use Docker Proxy #99

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# Build the manager binary
FROM golang:1.16 as builder
ARG DOCKER_PROXY
FROM ${DOCKER_PROXY}golang:1.16 as builder

WORKDIR /workspace
# Copy the Go Modules manifests
Expand Down
11 changes: 8 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,11 @@ else
GOBIN=$(shell go env GOBIN)
endif

# Get the golang image path
ifneq ($(origin DOCKER_PROXY), undefined)
DOCKER_IMAGE_PROXY = --build-arg DOCKER_PROXY=${DOCKER_PROXY}
endif

# Setting SHELL to bash allows bash commands to be executed by recipes.
# This is a requirement for 'setup-envtest.sh' in the test target.
# Options are set to exit when a recipe line exits non-zero or a piped command fails.
Expand Down Expand Up @@ -147,7 +152,7 @@ run: manifests generate fmt vet ## Run a controller from your host.
go run ./main.go

docker-build: test ## Build docker image with the manager.
docker build -t ${IMG} --rm .
docker build -t ${IMG} ${DOCKER_IMAGE_PROXY} --rm .

docker-push: ## Push docker image with the manager.
docker push ${IMG}
Expand Down Expand Up @@ -193,7 +198,7 @@ deploy: manifests kustomize deploy-local-kind ## Deploy controller to the K8s cl
.PHONY: deploy-k8s-cluster
deploy-k8s-cluster: manifests kustomize build ## Build manager and Deploy the deployment to kind cluster.
mkdir -p export
docker build -t ${IMG} --output type=tar,dest=export/vdo.tar .
docker build -t ${IMG} ${DOCKER_IMAGE_PROXY} --output type=tar,dest=export/vdo.tar .
cd config/manager && $(KUSTOMIZE) edit set image controller=${IMG}
./hack/deploy-vdo-cluster.sh ${IMG}

Expand Down Expand Up @@ -234,7 +239,7 @@ bundle: manifests kustomize ## Generate bundle manifests and metadata, then vali

.PHONY: bundle-build
bundle-build: bundle ## Build the bundle image for OLM
docker build -f bundle.Dockerfile -t $(BUNDLE_IMG) .
docker build -f bundle.Dockerfile -t $(BUNDLE_IMG) ${DOCKER_IMAGE_PROXY}.

.PHONY: bundle-push
bundle-push: ## Push the bundle image.
Expand Down