Skip to content

chore(deps): update docker/setup-buildx-action action to v3 #6

chore(deps): update docker/setup-buildx-action action to v3

chore(deps): update docker/setup-buildx-action action to v3 #6

Workflow file for this run

name: Build and Push controller Docker Images
on:
workflow_dispatch: {}
push:
paths:
- '.github/workflows/controller.yaml'
- 'controller/Dockerfile'
jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
arch:
- linux/amd64
- linux/arm64
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Login to GHCR
uses: docker/login-action@465a07811f14bebb1938fbed4728c6a1ff8901fc # v2
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Install Rust nightly
uses: dtolnay/rust-toolchain@master
with:
toolchain: nightly
targets: x86_64-unknown-linux-musl
components: rustfmt, clippy, miri, rust-src
- name: Install Rust stable
uses: dtolnay/rust-toolchain@master
with:
toolchain: stable
targets: x86_64-unknown-linux-musl
components: rustfmt, clippy
- name: Set Build Arguments
id: args
run: |
if [ "${{ matrix.arch }}" == "linux/arm64" ]; then
echo "BUILD=aarch64-unknown-linux-gnu" >> $GITHUB_OUTPUT
else
echo "BUILD=x86_64-unknown-linux-gnu" >> $GITHUB_OUTPUT
fi
- name: Install bpf-linker
run: |
cd controller
cargo install bpf-linker
cargo install cross --git https://github.com/cross-rs/cross
# # # build ebpf byte code
cargo xtask build-ebpf --release
cross build --target ${{ steps.args.outputs.BUILD }} --release
- uses: actions/upload-artifact@v3
with:
name: ${{ steps.args.outputs.BUILD }}-binary
path: controller/target/${{ steps.args.outputs.BUILD }}/release/kube-guardian
push:
runs-on: ubuntu-latest
needs: build
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up QEMU
uses: docker/setup-qemu-action@v1
with:
platforms: all
- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@d70bba72b1f3fd22344832f00baa16ece964efeb # v3
with:
install: true
version: latest
- name: Login to GHCR
uses: docker/login-action@465a07811f14bebb1938fbed4728c6a1ff8901fc # v2
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- uses: actions/download-artifact@v3
with:
name: x86_64-unknown-linux-gnu-binary
path: controller/linux/amd64
- uses: actions/download-artifact@v3
with:
name: aarch64-unknown-linux-gnu-binary
path: controller/linux/arm64
- name: Build and Push
env:
BUILDX_NO_DEFAULT_ATTESTATIONS: 1
if: github.ref == 'refs/heads/main'
uses: docker/build-push-action@v5
with:
context: controller/
platforms: linux/amd64, linux/arm64,
file: controller/Dockerfile
push: true
tags: |
ghcr.io/xentra-ai/images/guardian-controller:edge