From 413459d0fcc75ff17ce6c8de129a6f4273db67b2 Mon Sep 17 00:00:00 2001 From: AKP Date: Wed, 5 Apr 2023 17:59:58 +0100 Subject: [PATCH] Add `docker-image.yml` --- .github/workflows/docker-image.yml | 37 ++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 .github/workflows/docker-image.yml diff --git a/.github/workflows/docker-image.yml b/.github/workflows/docker-image.yml new file mode 100644 index 0000000..daa55c2 --- /dev/null +++ b/.github/workflows/docker-image.yml @@ -0,0 +1,37 @@ +name: Build Docker image + +on: + push: + branches: + - "master" + workflow_dispatch: + +env: + IMAGE_NAME: "ghcr.io/codemicro/analytics" + +concurrency: # Prevent two instances of this running at once + group: build-docker-image + cancel-in-progress: true + +jobs: + build: + + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v3 + + - name: Make image tags + id: make_tags + run: | + echo "::set-output name=LATEST::$IMAGE_NAME:latest" + echo "::set-output name=VERSIONED::$IMAGE_NAME:$(git rev-parse --short HEAD)" + + - name: Build Docker image + run: docker build . --file Dockerfile --tag ${{ steps.make_tags.outputs.LATEST }} --tag ${{ steps.make_tags.outputs.VERSIONED }} + + - name: Login to ghcr.io + run: echo ${{ secrets.GITHUB_TOKEN }} | docker login ghcr.io --username codemicro --password-stdin + + - name: Push image + run: docker push --all-tags $IMAGE_NAME