Skip to content

Docker Publish

Docker Publish #75

name: Docker Publish
on:
schedule:
- cron: "0 2 * * *" # Nightly at 2 AM UTC
workflow_dispatch: # Allow manual runs
permissions: {} # No permissions by default on workflow level
concurrency:
group: docker-publish
cancel-in-progress: false
jobs:
publish:
name: Publish (${{ matrix.device }})
runs-on: ${{ github.repository_owner == 'open-edge-platform' && 'overflow' || 'ubuntu-latest' }}
permissions:
contents: read # Checkout code
packages: write # Push images to GHCR
id-token: write # Cosign keyless signing (OIDC)
strategy:
fail-fast: false
matrix:
device: [cpu, xpu, cuda]
steps:
- name: Harden the runner
uses: step-security/harden-runner@9af89fc71515a100421586dfdb3dc9c984fbf411 # v2.19.4
with:
disable-sudo: false
disable-telemetry: true
egress-policy: block
allowed-endpoints: >
api.github.com:443
auth.docker.io:443
centralus.data.mcr.microsoft.com:443
deb.debian.org:80
developer.download.nvidia.com:443
download.pytorch.org:443
download-r2.pytorch.org:443
files.pythonhosted.org:443
fulcio.sigstore.dev:443
ghcr.io:443
ghcr1production.blob.core.windows.net:443
github.com:443
index.crates.io:443
pkg-containers.githubusercontent.com:443
ppa.launchpadcontent.net:443
production.cloudflare.docker.com:443
production.cloudfront.docker.com:443
pypi.org:443
registry.npmjs.org:443
registry-1.docker.io:443
rekor.sigstore.dev:443
release-assets.githubusercontent.com:443
static.crates.io:443
static.rust-lang.org:443
timestamp.sigstore.dev:443
tuf-repo-cdn.sigstore.dev:443
www.google-analytics.com:443
dl-cdn.alpinelinux.org:443
- name: Checkout repository
uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
with:
persist-credentials: false
- name: Read version
id: version
run: |
VERSION="$(tr -d '[:space:]' < application/VERSION)"
SHORT_SHA="$(echo "$GITHUB_SHA" | head -c 8)"
echo "version=${VERSION}" >> "$GITHUB_OUTPUT"
echo "short-sha=${SHORT_SHA}" >> "$GITHUB_OUTPUT"
- name: Log in to Container Registry
uses: docker/login-action@650006c6eb7dba73a995cc03b0b2d7f5ca915bee # v4.2.0
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Extract metadata (tags, labels)
id: meta
uses: docker/metadata-action@80c7e94dd9b9319bd5eb7a0e0fe9291e23a2a2e9 # v6.1.0
with:
images: ghcr.io/open-edge-platform/physical-ai-studio-${{ matrix.device }}
tags: |
type=raw,value=${{ steps.version.outputs.version }}-dev-${{ steps.version.outputs.short-sha }}
type=raw,value=${{ github.ref_name }}
- name: Build and push Docker image
uses: ./.github/actions/docker-build
with:
device: ${{ matrix.device }}
push: "true"
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
use-cache: "false" # To ensure that the application container images remain buildable
- name: Resolve primary image tag for signing
id: primary-tag
env:
TAGS: ${{ steps.meta.outputs.tags }}
run: |
# Use the first tag as the signing reference.
# The sign-image action resolves the digest from this tag via crane.
TAG="$(echo "$TAGS" | head -n1)"
echo "tag=${TAG}" >> "$GITHUB_OUTPUT"
- name: Sign Docker image
uses: open-edge-platform/geti-ci/actions/sign-image@7e686c1248b3939f8ee8e04e2612da727e379d91
with:
image-uri: ${{ steps.primary-tag.outputs.tag }}