Skip to content

Commit

Permalink
add dockerhub test
Browse files Browse the repository at this point in the history
Signed-off-by: Brian DeHamer <bdehamer@github.com>
  • Loading branch information
bdehamer committed May 10, 2024
1 parent 8bded0d commit 1be851e
Showing 1 changed file with 46 additions and 0 deletions.
46 changes: 46 additions & 0 deletions .github/workflows/oci-docker-hub.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
name: Attest Image (Docker Hub)

on:
workflow_dispatch:

jobs:
build-image-dockerhub:
name: Build & Attest
runs-on: ubuntu-latest
permissions:
id-token: write
attestations: write
env:
REGISTRY: index.docker.io
IMAGE_NAME: bdehamer/attest-demo
steps:
- name: Build artifact
run: date > artifact.bin
- name: Build Dockerfile
run: |
cat <<EOF > Dockerfile
FROM scratch
COPY artifact.bin .
EOF
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ github.actor }}
password: ${{ secrets.DOCKER_HUB_TOKEN }}
- name: Build and push Docker image
id: push
uses: docker/build-push-action@v5.0.0
with:
context: .
push: true
tags: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:latest
- name: Attest artifact
uses: actions/attest-build-provenance@v1
with:
subject-name: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
subject-digest: ${{ steps.push.outputs.digest }}
push-to-registry: true

0 comments on commit 1be851e

Please sign in to comment.