Skip to content

publish-docker-image #12

publish-docker-image

publish-docker-image #12

name: publish-docker-image
on: workflow_dispatch
env:
REGISTRY: ghcr.io
IMAGE_NAME: nesp-tsr3-1/tsx-workflow
jobs:
build-and-push-image:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
attestations: write
id-token: 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 }}
- name: Build and push Docker image
id: push
uses: docker/build-push-action@v5
with:
platforms: linux/amd64,linux/arm64
file: containers/Dockerfile
context: .
push: true
tags: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME}}:latest
cache-from: type=gha
cache-to: type=gha,mode=max
- name: Generate artifact attestation
uses: actions/attest-build-provenance@v1
with:
subject-name: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME}}
subject-digest: ${{ steps.push.outputs.digest }}
push-to-registry: true