From 35316eae6b618cbf29152116881913f3ee5befd0 Mon Sep 17 00:00:00 2001 From: "Glenn Y. Rolland" Date: Thu, 25 Nov 2021 16:59:13 +0100 Subject: [PATCH] Better tagging of images --- .github/workflows/build-and-publish.yml | 5 +++++ Makefile | 12 ++++++++++++ 2 files changed, 17 insertions(+) diff --git a/.github/workflows/build-and-publish.yml b/.github/workflows/build-and-publish.yml index c1201f5..01e124f 100644 --- a/.github/workflows/build-and-publish.yml +++ b/.github/workflows/build-and-publish.yml @@ -17,6 +17,9 @@ jobs: # steps to perform in job steps: + - name: Set current date as env variable + run: echo "BUILD_VERSION::v$(date +'%Y%m%d_%H%M')" >> $GITHUB_ENV + - name: Checkout code uses: actions/checkout@v2 @@ -40,9 +43,11 @@ jobs: file: docker/Dockerfile # Note: tags has to be all lower-case tags: | + glenux/teaching-boilerplate:${{ env.BUILD_VERSION }} glenux/teaching-boilerplate:latest # build on feature branches, push only on main branch push: ${{ github.ref == 'refs/heads/master' }} - name: Image digest run: echo ${{ steps.docker_build.outputs.digest }} + diff --git a/Makefile b/Makefile index cf0cd8d..bbb7aa1 100755 --- a/Makefile +++ b/Makefile @@ -19,6 +19,7 @@ BUILD_SLIDES_DIR=$(BUILD_DIR)/slides BUILD_DOCS_DIR=$(BUILD_DIR)/docs BUILD_IMAGES_DIR=images +BUILD_VERSION=v$(shell date "+%Y%m%d-%H%M") ## Ports DOCS_PORT=5100 @@ -222,3 +223,14 @@ fixme: @egrep --color -rni '(fixme)' $(DOCS_DIR) $(SLIDES_DIR) .PHONY: fixme + +docker-build: + docker build -t glenux/teaching-boilerplate:$(BUILD_VERSION) + docker tag glenux/teaching-boilerplate:$(BUILD_VERSION) glenux/teaching-boilerplate:latest + +docker-push: + docker push glenux/teaching-boilerplate:latest + +docker-pull: + docker pull glenux/teaching-boilerplate:latest +