oura 2.2.0

The tail of Cardano
Documentation
name: Docker

on:
  push:
    branches:
      - main
    tags:
      - "v*"

jobs:
  build:
    strategy:
      matrix:
        include:
          - release_for: Linux-x86_64
            build_on: ubuntu-22.04
            target: x86_64-unknown-linux-gnu

          - release_for: Linux-arm64
            build_on: ubuntu-22.04-arm
            target: aarch64-unknown-linux-gnu

    runs-on: ${{ matrix.build_on }}

    steps:
      - name: Checkout repository
        uses: actions/checkout@v4

      # Installs the toolchain + components pinned in rust-toolchain.toml.
      - name: Install Rust toolchain
        run: rustup show active-toolchain || rustup toolchain install

      - name: Install Protoc
        uses: arduino/setup-protoc@v3
        with:
          repo-token: ${{ secrets.GITHUB_TOKEN }}

      - uses: Swatinem/rust-cache@v2
        with:
          shared-key: docker-${{ matrix.target }}

      - name: Run cargo build
        run: cargo build --target ${{ matrix.target }} --all-features --locked --release

      - name: Rename binary
        run: mv target/${{ matrix.target }}/release/oura oura-${{ matrix.release_for }}

      - name: Upload artifacts
        uses: actions/upload-artifact@v4
        with:
          name: binaries-${{ matrix.release_for }}
          path: oura-${{ matrix.release_for }}

  docker:
    runs-on: ubuntu-latest
    needs: [build]

    permissions:
      contents: read
      packages: write

    steps:
      - name: Checkout repository
        uses: actions/checkout@v4

      - name: Set up Docker Buildx
        uses: docker/setup-buildx-action@v3

      - name: Extract metadata (tags, labels) for Docker
        id: meta
        uses: docker/metadata-action@v5
        with:
          images: ghcr.io/txpipe/oura
          tags: |
            type=raw,value=latest,enable={{is_default_branch}}
            type=raw,value=stable,enable=${{ startsWith(github.ref, 'refs/tags/v') }}
            type=semver,pattern=v{{major}},enable=${{ startsWith(github.ref, 'refs/tags/v') }}
            type=semver,pattern=v{{major}}.{{minor}},enable=${{ startsWith(github.ref, 'refs/tags/v') }}
            type=semver,pattern=v{{version}},enable=${{ startsWith(github.ref, 'refs/tags/v') }}
            type=sha

      - name: Login to GitHub Container Registry
        uses: docker/login-action@v3
        with:
          registry: ghcr.io
          username: ${{ github.actor }}
          password: ${{ secrets.GITHUB_TOKEN }}

      - name: Download artifacts
        uses: actions/download-artifact@v4
        with:
          pattern: binaries-*
          merge-multiple: true
          path: .github/image/bin

      # Rename the artifact so the suffix matches the value Docker uses for
      # TARGETARCH (amd64), keeping the Dockerfile COPY simple. arm64 already
      # matches.
      - name: Rename artifacts
        run: mv .github/image/bin/oura-Linux-x86_64 .github/image/bin/oura-Linux-amd64

      - name: Build and push
        id: build
        uses: docker/build-push-action@v6
        with:
          context: .github/image
          platforms: linux/arm64,linux/amd64
          push: true
          tags: ${{ steps.meta.outputs.tags }}
          labels: ${{ steps.meta.outputs.labels }}

      # Basic smoke test: run the image we just pushed and make sure the binary
      # actually executes. Pulling by digest selects the amd64 variant on this
      # runner, which catches runtime breakage like a glibc mismatch against the
      # debian:12-slim base.
      - name: Smoke test
        run: docker run --rm ghcr.io/txpipe/oura@${{ steps.build.outputs.digest }} --version