diff --git a/.github/workflows/build_push.yml b/.github/workflows/build_push.yml index 1618c66..ba54f9c 100644 --- a/.github/workflows/build_push.yml +++ b/.github/workflows/build_push.yml @@ -20,8 +20,17 @@ jobs: id: vars run: echo ::set-output name=tag::$(echo ${GITHUB_REF:10}) - - name: Build the tagged Docker image + - name: Build image from alpine run: make build-alpine TAG="${{steps.vars.outputs.tag}}" + - name: Push alpine-based image + run: make push-alpine TAG="${{steps.vars.outputs.tag}}" + + - name: Build image from debian + run: make build-debian TAG="${{steps.vars.outputs.tag}}" + + - name: Push debian-based image + run: make push-debian TAG="${{steps.vars.outputs.tag}}" + - name: Logout from DockerHub run: docker logout \ No newline at end of file diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..47b467c --- /dev/null +++ b/Makefile @@ -0,0 +1,46 @@ +ifndef TAG +$(error The TAG variable is missing.) +endif + +# Docker Hub namespace +HUB_NAMESPACE="invoiceninja" + +# Image name +IMAGE="invoiceninja" + + +# Building docker images based on alpine. +# Assigned tags: +# - :alpine +# - :alpine- +.PHONY: build-alpine +build-alpine: + $(info Make: Building "$(TAG)" tagged images from alpine.) + @docker build -t ${HUB_NAMESPACE}/${IMAGE}:alpine-${TAG} --build-arg INVOICENINJA_VERSION=${TAG} --file ./alpine/Dockerfile . + @docker tag ${HUB_NAMESPACE}/${IMAGE}:alpine-${TAG} ${HUB_NAMESPACE}/${IMAGE}:alpine + $(info Make: Done.) + +.PHONY: push-alpine +push-alpine: + $(info Make: Pushing tagged images from alpine.) + @docker push ${HUB_NAMESPACE}/${IMAGE}:alpine-${TAG} + @docker push ${HUB_NAMESPACE}/${IMAGE}:alpine + $(info Make: Done.) + +# Building docker images based on debian. +# Assigned tags: +# - :latest +# - : +.PHONY: build-debian +build-debian: + $(info Make: Building "$(TAG)" tagged images from debian.) + @docker build -t ${HUB_NAMESPACE}/${IMAGE}:${TAG} --build-arg INVOICENINJA_VERSION=${TAG} --file ./debian/Dockerfile . + @docker tag ${HUB_NAMESPACE}/${IMAGE}:${TAG} ${HUB_NAMESPACE}/${IMAGE}:latest + $(info Make: Done.) + +.PHONY: push-debian +push-debian: + $(info Make: Pushing tagged images from debian.) + @docker push ${HUB_NAMESPACE}/${IMAGE}:${TAG} + @docker push ${HUB_NAMESPACE}/${IMAGE}:latest + $(info Make: Done.) \ No newline at end of file