Add context argument #10
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Create and push a Docker image | |
on: | |
push: | |
branches: ['main'] | |
env: | |
REGISTRY: ghcr.io | |
IMAGE_NAME: ${{ github.repository }} | |
VERSION: $GITHUB_SHA | |
jobs: | |
build-and-push-image: | |
runs-on: ubuntu-latest | |
permissions: | |
contents: read | |
packages: write | |
steps: | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v3 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Create version tag | |
id: version | |
run: echo "tag=$(git show -s --format="%ct-%h" $GITHUB_SHA)" >> $GITHUB_OUTPUT | |
- name: Setup Rust toolchain | |
uses: dtolnay/rust-toolchain@7164405e8653277d57afd42ba081b5aa02a70396 | |
with: | |
toolchain: stable | |
- name: Install development tools | |
uses: taiki-e/install-action@f8a64c940979268d3ab5ac99c178e718ed90977d # v2.32.14 | |
with: | |
tool: cross | |
- name: Build | |
run: | | |
cross build --release --target x86_64-unknown-linux-gnu | |
mv target/x86_64-unknown-linux-gnu/release/kuberwave kuberwave.amd64 | |
cross build --release --target aarch64-unknown-linux-gnu | |
mv target/aarch64-unknown-linux-gnu/release/kuberwave kuberwave.arm64 | |
- name: Log in to the container registry | |
uses: docker/login-action@v3 | |
with: | |
registry: ${{ env.REGISTRY }} | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Build and push Docker image | |
uses: docker/build-push-action@v5 | |
with: | |
pull: true | |
push: true | |
platforms: linux/amd64,linux/arm64 | |
context: . | |
tags: | | |
${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:latest | |
${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ steps.version.outputs.tag }} | |
build-args: VERSION=${{ steps.version.outputs.tag }} |