Skip to content

Workflow file for this run

#
name: Create and publish a Docker image
on:
workflow_dispatch:
release:
types: [published]
# Defines environment variables for the workflow. These are used for the Container registry domain, and a version for the Docker image that this workflow builds.
env:
REGISTRY: ghcr.io
VERSION: ${{ github.ref_name }}
jobs:
build-and-push-image-gpu:
runs-on: ubuntu-latest
# Sets the permissions granted to the `GH_PAT` for the actions in this job.
permissions:
contents: read
packages: write
steps:
- name: Checkout repository
uses: actions/checkout@v4
# Uses the `docker/login-action` action to log in to the Container registry registry using the account and password that will publish the packages. Once published, the packages are scoped to the account defined here.
- name: Log in to the Container registry
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GH_PAT }}
- name: lowercase github.repository
run: |
echo "IMAGE_NAME=`echo ${{github.repository}} | tr '[:upper:]' '[:lower:]'`" >>${GITHUB_ENV}
- name: Build and push Docker image
uses: docker/build-push-action@v6
with:
context: .
file: ./Dockerfile-gpu
push: true
tags: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:latest, ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ env.VERSION }}