From 2fe6ec3783de5a124be2fc8e2b41161f1cad69f8 Mon Sep 17 00:00:00 2001 From: sid palas Date: Fri, 3 Feb 2023 16:30:27 -0500 Subject: [PATCH] add push make targets for images --- .../api-golang/Makefile | 18 ++++++++++++++++-- 06-building-container-images/api-node/Makefile | 16 +++++++++++++++- .../client-react/Makefile | 18 ++++++++++++++++-- 3 files changed, 47 insertions(+), 5 deletions(-) diff --git a/06-building-container-images/api-golang/Makefile b/06-building-container-images/api-golang/Makefile index 1b53676..6f3380c 100644 --- a/06-building-container-images/api-golang/Makefile +++ b/06-building-container-images/api-golang/Makefile @@ -1,12 +1,26 @@ API_GOLANG_PATH:=../../05-example-web-application/api-golang/ +DOCKERHUB_REPO:=sidpalas/devops-directive-docker-course-api-golang N?=0 .PHONY: build-N build-N: - docker build --file ./Dockerfile.$(N) -t api-golang:$(N) ${API_GOLANG_PATH} + docker build --file ./Dockerfile.${N} \ + -t api-golang:${N} \ + -t ${DOCKERHUB_REPO}:${N} \ + ${API_GOLANG_PATH} .PHONY: build-all build-all: for number in 0 1 2 3 4 5 6 ; do \ N=$$number $(MAKE) build-N; \ - done \ No newline at end of file + done + +.PHONY: push-N +push-N: + docker push ${DOCKERHUB_REPO}:${N} + +.PHONY: push-all +push-all: + for number in 0 1 2 3 4 5 6 ; do \ + N=$$number $(MAKE) push-N; \ + done diff --git a/06-building-container-images/api-node/Makefile b/06-building-container-images/api-node/Makefile index 07f2e74..75d654f 100644 --- a/06-building-container-images/api-node/Makefile +++ b/06-building-container-images/api-node/Makefile @@ -1,12 +1,26 @@ API_NODE_PATH:=../../05-example-web-application/api-node/ +DOCKERHUB_REPO:=sidpalas/devops-directive-docker-course-api-node N?=0 .PHONY: build-N build-N: - docker build --file ./Dockerfile.$(N) -t api-node:$(N) ${API_NODE_PATH} + docker build --file ./Dockerfile.${N} \ + -t api-node:${N} \ + -t ${DOCKERHUB_REPO}:${N} \ + ${API_NODE_PATH} .PHONY: build-all build-all: for number in 0 1 2 3 4 5 6 7 ; do \ N=$$number $(MAKE) build-N; \ + done + +.PHONY: push-N +push-N: + docker push ${DOCKERHUB_REPO}:${N} + +.PHONY: push-all +push-all: + for number in 0 1 2 3 4 5 6 7; do \ + N=$$number $(MAKE) push-N; \ done \ No newline at end of file diff --git a/06-building-container-images/client-react/Makefile b/06-building-container-images/client-react/Makefile index eec16b6..1ad1b82 100644 --- a/06-building-container-images/client-react/Makefile +++ b/06-building-container-images/client-react/Makefile @@ -1,12 +1,26 @@ API_NODE_PATH:=../../05-example-web-application/client-react/ +DOCKERHUB_REPO:=sidpalas/devops-directive-docker-course-client-react-nginx N?=0 .PHONY: build-N build-N: - docker build --file ./Dockerfile.$(N) -t client-react:$(N) ${API_NODE_PATH} + docker build --file ./Dockerfile.${N} \ + -t client-react:${N} \ + -t ${DOCKERHUB_REPO}:${N} \ + ${API_NODE_PATH} .PHONY: build-all build-all: for number in 0 1 2 3 4 5; do \ N=$$number $(MAKE) build-N; \ - done \ No newline at end of file + done + +.PHONY: push-N +push-N: + docker push ${DOCKERHUB_REPO}:${N} + +.PHONY: push-all +push-all: + for number in 0 1 2 3 4 5; do \ + N=$$number $(MAKE) push-N; \ + done