Skip to content

Fix the build

Fix the build #3

Workflow file for this run

name: Build and push Docker image
on:
push:
branches:
- '**'
tags:
- 'v*'
permissions:
contents: read
packages: write
jobs:
build-and-push:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Log in to GHCR
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Compute image tags
id: vars
run: |
# Lowercase the repo for GHCR
IMAGE="ghcr.io/${GITHUB_REPOSITORY,,}"
if [[ "${GITHUB_REF_TYPE}" == "tag" ]]; then
TAG_NAME="${GITHUB_REF_NAME}" # e.g. v1.2.3
echo "tags=${IMAGE}:${TAG_NAME},${IMAGE}:latest" >> $GITHUB_OUTPUT
else
SHORT_SHA=$(echo "${GITHUB_SHA}" | cut -c1-7)
echo "tags=${IMAGE}:sha-${SHORT_SHA}" >> $GITHUB_OUTPUT
fi
- name: Build and push
uses: docker/build-push-action@v6
with:
context: .
file: ./Dockerfile
push: true
tags: ${{ steps.vars.outputs.tags }}