Skip to content

Commit

Permalink
Allow pushing multi-arch (linux/arm64, linux/amd64) to Docker Hub (#4)
Browse files Browse the repository at this point in the history
  • Loading branch information
paulo-ferraz-oliveira authored Mar 10, 2023
1 parent 0df5940 commit 31920ea
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 0 deletions.
37 changes: 37 additions & 0 deletions Makefile
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
1 change: 1 addition & 0 deletions VERSION
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
1.0.1

0 comments on commit 31920ea

Please sign in to comment.