From 4c7230baf487208b07e197656305ddd175924c00 Mon Sep 17 00:00:00 2001 From: jayesh Date: Thu, 11 Jul 2024 16:48:10 -0500 Subject: [PATCH] Test how to add Git Tag to built docker image --- .github/workflows/build-publish-image.yml | 2 +- Dockerfile | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build-publish-image.yml b/.github/workflows/build-publish-image.yml index fff2a6f..bdc8c91 100644 --- a/.github/workflows/build-publish-image.yml +++ b/.github/workflows/build-publish-image.yml @@ -21,5 +21,5 @@ jobs: - name: Build and push Docker image run: | docker login --username scadaguru --password ${{ secrets.GHCR_TOKEN }} ghcr.io - docker build . -t ghcr.io/scadaguru/test-auto-docker-build:${{ github.ref_name }} -t ghcr.io/scadaguru/test-auto-docker-build:v$(TZ="America/Chicago" date +'%Y%m%d.%H%M%S') -t ghcr.io/scadaguru/test-auto-docker-build + docker build . --build-arg GIT_TAG=${{ github.ref_name }} -t ghcr.io/scadaguru/test-auto-docker-build:${{ github.ref_name }} -t ghcr.io/scadaguru/test-auto-docker-build:v$(TZ="America/Chicago" date +'%Y%m%d.%H%M%S') -t ghcr.io/scadaguru/test-auto-docker-build docker push ghcr.io/scadaguru/test-auto-docker-build --all-tags diff --git a/Dockerfile b/Dockerfile index d36e6ef..e4b9940 100644 --- a/Dockerfile +++ b/Dockerfile @@ -10,4 +10,7 @@ COPY *.py /src EXPOSE 5000 +ARG GIT_TAG=unknown +LABEL version=$GIT_TAG + CMD ["python", "-u", "/src/main.py" ] \ No newline at end of file