Docker Build and Publish #26
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Docker Build and Publish | |
on: | |
push: | |
tags: [ 'v*.*.*' ] | |
# Allow manual trigger from GitHub UI | |
workflow_dispatch: | |
env: | |
REGISTRY: ghcr.io | |
IMAGE_NAME: ${{ github.repository }} | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
permissions: | |
contents: read | |
packages: write | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Log in to the Container registry | |
uses: docker/login-action@v3 | |
with: | |
registry: ${{ env.REGISTRY }} | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
# Extract metadata for GPU image | |
- name: Extract metadata (tags, labels) for GPU Docker | |
id: meta-gpu | |
uses: docker/metadata-action@v5 | |
with: | |
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} | |
tags: | | |
type=semver,pattern=v{{version}} | |
type=semver,pattern=v{{major}}.{{minor}} | |
type=semver,pattern=v{{major}} | |
type=raw,value=latest | |
# Extract metadata for CPU image | |
- name: Extract metadata (tags, labels) for CPU Docker | |
id: meta-cpu | |
uses: docker/metadata-action@v5 | |
with: | |
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} | |
flavor: | | |
suffix=-cpu | |
tags: | | |
type=semver,pattern=v{{version}} | |
type=semver,pattern=v{{major}}.{{minor}} | |
type=semver,pattern=v{{major}} | |
type=raw,value=latest | |
# Build and push GPU version | |
- name: Build and push GPU Docker image | |
uses: docker/build-push-action@v5 | |
with: | |
context: . | |
file: ./Dockerfile | |
push: true | |
tags: ${{ steps.meta-gpu.outputs.tags }} | |
labels: ${{ steps.meta-gpu.outputs.labels }} | |
platforms: linux/amd64 | |
# Build and push CPU version | |
- name: Build and push CPU Docker image | |
uses: docker/build-push-action@v5 | |
with: | |
context: . | |
file: ./Dockerfile.cpu | |
push: true | |
tags: ${{ steps.meta-cpu.outputs.tags }} | |
labels: ${{ steps.meta-cpu.outputs.labels }} | |
platforms: linux/amd64 | |
# Extract metadata for UI image | |
- name: Extract metadata (tags, labels) for UI Docker | |
id: meta-ui | |
uses: docker/metadata-action@v5 | |
with: | |
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} | |
flavor: | | |
suffix=-ui | |
tags: | | |
type=semver,pattern=v{{version}} | |
type=semver,pattern=v{{major}}.{{minor}} | |
type=semver,pattern=v{{major}} | |
type=raw,value=latest | |
# Build and push UI version | |
- name: Build and push UI Docker image | |
uses: docker/build-push-action@v5 | |
with: | |
context: ./ui | |
file: ./ui/Dockerfile | |
push: true | |
tags: ${{ steps.meta-ui.outputs.tags }} | |
labels: ${{ steps.meta-ui.outputs.labels }} | |
platforms: linux/amd64 | |
create-release: | |
needs: build | |
runs-on: ubuntu-latest | |
# Only run this job if we're pushing a tag | |
if: startsWith(github.ref, 'refs/tags/') | |
permissions: | |
contents: write | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Create Release | |
uses: softprops/action-gh-release@v1 | |
with: | |
generate_release_notes: true | |
draft: false | |
prerelease: false |