Skip to content

make image tag unique #2

make image tag unique

make image tag unique #2

Workflow file for this run

name: release docker image
on:
push:
branches: [ main ]
schedule:
- cron: '5 12 3 * *' # every 3rd at 12:05
jobs:
build:
strategy:
matrix:
image:
- alpine
- debian
permissions: write-all
name: build ${{ matrix.image }} image
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: build the image
run: |
docker build -f Dockerfile.${{ matrix.image }} -t tbi:${{ matrix.image }} .
- name: login to ghcr.io
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: push the image
run: |
IMAGE_ID=ghcr.io/${{ github.repository_owner }}/tbi
VERSION=${{ matrix.image }}:${{ github.sha }}
echo IMAGE_ID=$IMAGE_ID
echo VERSION=$VERSION
docker tag tbi:${{ matrix.image }} $IMAGE_ID:$VERSION
docker push $IMAGE_ID:$VERSION