-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Allow pushing multi-arch (linux/arm64, linux/amd64) to Docker Hub (#4)
- Loading branch information
1 parent
0df5940
commit 31920ea
Showing
2 changed files
with
38 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
SHELL := bash | ||
.ONESHELL: | ||
.SHELLFLAGS := -euc | ||
.DELETE_ON_ERROR: | ||
MAKEFLAGS += --warn-undefined-variables | ||
MAKEFLAGS += --no-builtin-rules | ||
|
||
VERSION := $(shell cat VERSION) | ||
IMAGE := pauloferrazoliveira/dogstatsd-2-statsd | ||
|
||
all: | ||
echo "Current version (file VERSION) is ${VERSION}" | ||
echo "Options:" | ||
echo " - make version-check" | ||
echo " - make configure-multiarch" | ||
echo " - make build-push" | ||
.PHONY: all | ||
|
||
version-check: | ||
ifndef ENV_VAR | ||
@echo Version is ${VERSION}. Continue? [Y/n] | ||
@read line; if [ $$line != "Y" ]; then echo "Aborting..."; exit 1 ; fi | ||
endif | ||
.PHONY: version-check | ||
|
||
configure-multiarch: | ||
@echo "An error like 'ERROR: existing instance for \"multi-arch-builder\"...' is Ok, in the next line" | ||
@docker buildx create --name multi-arch-builder --use || true | ||
.PHONY: configure-multiarch | ||
|
||
build-push: version-check | ||
@$(MAKE) configure-multiarch | ||
@echo "Building ${VERSION} (also as latest) and pushing..." | ||
@docker buildx build --platform linux/amd64,linux/arm64 . --tag ${IMAGE}:${VERSION} --push | ||
@docker buildx build --platform linux/amd64,linux/arm64 . --tag ${IMAGE}:latest --push | ||
@echo "... built and pushed!" | ||
.PHONY: build-push |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
1.0.1 |