|
| 1 | +name: Create and publish blobstream docker image |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + # TODO remove austin/docker_pub after testing |
| 6 | + branches: ['main', 'austin/docker_pub'] |
| 7 | + |
| 8 | +# Defines two custom environment variables for the workflow. These are used for the Container registry domain, and a name for the Docker image that this workflow builds. |
| 9 | +env: |
| 10 | + REGISTRY: ghcr.io |
| 11 | + IMAGE_NAME: ${{ github.repository }} |
| 12 | + |
| 13 | +# There is a single job in this workflow. It's configured to run on the latest available version of Ubuntu. |
| 14 | +jobs: |
| 15 | + build-and-push-image: |
| 16 | + runs-on: ubuntu-latest |
| 17 | + permissions: |
| 18 | + contents: read |
| 19 | + packages: write |
| 20 | + attestations: write |
| 21 | + id-token: write |
| 22 | + steps: |
| 23 | + - name: Checkout repository |
| 24 | + uses: actions/checkout@v4 |
| 25 | + - name: Log in to the Container registry |
| 26 | + uses: docker/login-action@65b78e6e13532edd9afa3aa52ac7964289d1a9c1 |
| 27 | + with: |
| 28 | + registry: ${{ env.REGISTRY }} |
| 29 | + username: ${{ github.actor }} |
| 30 | + password: ${{ secrets.GITHUB_TOKEN }} |
| 31 | + - name: Extract metadata (tags, labels) for Docker |
| 32 | + id: meta |
| 33 | + uses: docker/metadata-action@9ec57ed1fcdbf14dcef7dfbe97b2010124a938b7 |
| 34 | + with: |
| 35 | + images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} |
| 36 | + |
| 37 | + # Install risczero toolchain to build the program ELF and image ID deterministically in docker. |
| 38 | + - name: risczero toolchain install |
| 39 | + run: | |
| 40 | + cargo install cargo-binstall --version '=1.6.9' --locked |
| 41 | + cargo binstall [email protected] --no-confirm --force |
| 42 | + cargo risczero install |
| 43 | + - name: cargo check to build ELF and image ID |
| 44 | + env: |
| 45 | + RISC0_USE_DOCKER: true |
| 46 | + run: cargo check |
| 47 | + |
| 48 | + - name: Build and push Docker image |
| 49 | + id: push |
| 50 | + uses: docker/build-push-action@f2a1d5e99d037542a71f64918e516c093c6f3fc4 |
| 51 | + with: |
| 52 | + context: ./dockerfiles/blobstream0.Dockerfile |
| 53 | + push: true |
| 54 | + tags: ${{ steps.meta.outputs.tags }} |
| 55 | + labels: ${{ steps.meta.outputs.labels }} |
| 56 | + |
| 57 | + - name: Generate artifact attestation |
| 58 | + uses: actions/attest-build-provenance@v1 |
| 59 | + with: |
| 60 | + subject-name: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME}} |
| 61 | + subject-digest: ${{ steps.push.outputs.digest }} |
| 62 | + push-to-registry: true |
| 63 | + |
0 commit comments