Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
86 changes: 86 additions & 0 deletions .github/workflows/build-rust-broker-containers.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
name: Build Rust Broker Containers

on:
push:
branches: [ main ]
paths:
- .github/workflows/build-rust-broker-containers.yml
- build/brokers/Dockerfile.rust
- brokers/**
- version.txt
pull_request:
branches: [ main ]
paths:
- .github/workflows/build-rust-broker-containers.yml
- build/brokers/Dockerfile.rust
- brokers/**
- version.txt
release:
types:
- published

jobs:
build-brokers:
runs-on: ubuntu-latest
timeout-minutes: 50

# Allow GITHUB_TOKEN to push to GHCR
permissions:
contents: read
packages: write

strategy:
matrix:
component:
- udev-video-broker

steps:
- name: Checkout the head commit of the branch
uses: actions/checkout@v4
with:
persist-credentials: false

- name: Get version.txt
id: version-string
run: |
echo "version=$(cat version.txt)" >> $GITHUB_OUTPUT

- name: Set up QEMU
uses: docker/setup-qemu-action@v3

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

- name: Login to GitHub Container Registry
if: github.event_name == 'push' || github.event_name == 'release'
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Docker meta
uses: docker/metadata-action@v5
id: meta
with:
images: ghcr.io/project-akri/examples/${{ matrix.component }}
labels: |
org.opencontainers.image.title=akri-${{ matrix.component }}
org.opencontainers.image.description=Akri Broker
tags: |
type=ref,event=pr
type=semver,pattern=v{{version}}
type=semver,pattern=v{{major}}.{{minor}}
type=raw,value=v${{ steps.version-string.outputs.version }}-dev,enable=${{ github.event_name != 'release' }}

- name: Build and push
uses: docker/build-push-action@v5
with:
context: brokers/${{ matrix.component }}
push: ${{ github.event_name != 'pull_request' }}
build-args: |
EXTRA_CARGO_ARGS=--release
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
file: build/brokers/Dockerfile.rust
platforms: linux/amd64,linux/arm64,linux/arm/v7
7 changes: 7 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
**/target/
**/obj
**/bin
**/cobertura.xml
.idea
*.pyc
pki/*
16 changes: 11 additions & 5 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -29,18 +29,24 @@ TIMESTAMP := $(shell date +"%Y%m%d_%H%M%S")
VERSION_LABEL=v$(VERSION)-$(TIMESTAMP)
LABEL_PREFIX ?= $(VERSION_LABEL)

%-app:
docker buildx build $(COMMON_DOCKER_BUILD_ARGS) --build-arg APPLICATION=$@ --tag "$(PREFIX)/$@:$(LABEL_PREFIX)" --file $(DOCKERFILE_DIR)/Dockerfile.python-app .

.PHONY: all
all: apps
all: apps brokers

.PHONY: apps
apps: anomaly-detection-app video-streaming-app

%-app:
docker buildx build $(COMMON_DOCKER_BUILD_ARGS) \
--build-arg APPLICATION=$@ \
--tag "$(PREFIX)/$@:$(LABEL_PREFIX)" \
--build-arg APPLICATION=$@ \
--file build/apps/Dockerfile.python-app .

.PHONY: brokers
brokers: udev-video-broker

udev-video-broker:
docker buildx build $(COMMON_DOCKER_BUILD_ARGS) \
--tag "$(PREFIX)/$@:$(LABEL_PREFIX)" \
--build-arg EXTRA_CARGO_ARGS="$(if $(BUILD_RELEASE_FLAG), --release)" \
--file build/brokers/Dockerfile.rust \
brokers/$@
Loading
Loading