Better tagging of images

This commit is contained in:
Glenn Y. Rolland 2021-11-25 16:59:13 +01:00
parent ace7dd095a
commit 35316eae6b
2 changed files with 17 additions and 0 deletions

View file

@ -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 }}

View file

@ -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