|
| 1 | +name: Container API BN Recovery Image |
| 2 | + |
| 3 | +on: |
| 4 | + schedule: |
| 5 | + - cron: "0 8 * * 4" |
| 6 | + workflow_dispatch: |
| 7 | + pull_request: |
| 8 | + paths: |
| 9 | + - '.github/workflows/container-api-bn-recovery.yml' |
| 10 | + - 'ic-os/api-bn-recovery/Dockerfile' |
| 11 | + - 'ic-os/api-bn-recovery/entrypoint.sh' |
| 12 | + |
| 13 | +concurrency: |
| 14 | + group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} |
| 15 | + cancel-in-progress: true |
| 16 | + |
| 17 | +permissions: |
| 18 | + contents: read |
| 19 | + packages: write |
| 20 | + |
| 21 | +jobs: |
| 22 | + build-and-push: |
| 23 | + name: Build and Push API BN Recovery Image |
| 24 | + runs-on: |
| 25 | + labels: dind-large |
| 26 | + container: |
| 27 | + image: ghcr.io/dfinity/ic-build@sha256:2caf6df6009b29ede72a520b60f3db064324e22192be532349caa82a987f8c50 |
| 28 | + options: >- |
| 29 | + -e NODE_NAME --privileged --cgroupns host |
| 30 | + --mount type=tmpfs,target="/home/buildifier/.local/share/containers" |
| 31 | + timeout-minutes: 60 |
| 32 | + steps: |
| 33 | + - name: Checkout |
| 34 | + uses: actions/checkout@v4 |
| 35 | + |
| 36 | + - name: Build binaries with Bazel |
| 37 | + run: | |
| 38 | + set -euo pipefail |
| 39 | + bazel build \ |
| 40 | + //rs/boundary_node/ic_boundary:ic-boundary \ |
| 41 | + //rs/orchestrator/registry_replicator:ic-registry-replicator |
| 42 | +
|
| 43 | + - name: Prepare build context |
| 44 | + run: | |
| 45 | + set -euo pipefail |
| 46 | + cp bazel-bin/rs/boundary_node/ic_boundary/ic-boundary ic-os/api-bn-recovery/ic-boundary |
| 47 | + cp bazel-bin/rs/orchestrator/registry_replicator/ic-registry-replicator ic-os/api-bn-recovery/ic-registry-replicator |
| 48 | + cp ic-os/components/guestos/share/nns_public_key.pem ic-os/api-bn-recovery/nns_public_key.pem |
| 49 | +
|
| 50 | + - name: Login to GHCR |
| 51 | + run: | |
| 52 | + mkdir -p "$HOME/.docker" |
| 53 | + podman login \ |
| 54 | + --compat-auth-file="$HOME/.docker/config.json" \ |
| 55 | + -u ${{ github.actor }} \ |
| 56 | + -p ${{ secrets.GITHUB_TOKEN }} \ |
| 57 | + ghcr.io |
| 58 | +
|
| 59 | + - name: Build container image |
| 60 | + run: | |
| 61 | + set -euo pipefail |
| 62 | + DATE="$(date '+%Y-%m-%d')" |
| 63 | + SHA="${{ github.sha }}" |
| 64 | + SHORT_SHA="${SHA:0:9}" |
| 65 | +
|
| 66 | + podman build \ |
| 67 | + -t "ghcr.io/${{ github.repository_owner }}/api-boundary-node:${DATE}" \ |
| 68 | + -t "ghcr.io/${{ github.repository_owner }}/api-boundary-node:${SHORT_SHA}" \ |
| 69 | + -t "ghcr.io/${{ github.repository_owner }}/api-boundary-node:latest" \ |
| 70 | + ic-os/api-bn-recovery |
| 71 | +
|
| 72 | + echo "DATE=${DATE}" >> "$GITHUB_ENV" |
| 73 | + echo "SHORT_SHA=${SHORT_SHA}" >> "$GITHUB_ENV" |
| 74 | +
|
| 75 | + - name: Push container image |
| 76 | + if: github.ref_name == 'master' |
| 77 | + run: | |
| 78 | + set -euo pipefail |
| 79 | + for tag in "${{ env.DATE }}" "${{ env.SHORT_SHA }}" latest; do |
| 80 | + podman push "ghcr.io/${{ github.repository_owner }}/api-boundary-node:${tag}" |
| 81 | + done |
0 commit comments