Skip to content
Closed
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
66 changes: 66 additions & 0 deletions .github/workflows/build-push-controller.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
name: Build and Push Controller Image

permissions:
contents: read

on:
workflow_dispatch:
inputs:
tag:
description: "Image tag override (defaults to git SHA)"
required: false
type: string
push:
branches: [main]
paths:
- "Dockerfile"
- "cmd/**"
- "controllers/**"
- "internal/**"
- "api/**"
- "extensions/**"
- "go.mod"
- "go.sum"
- ".github/workflows/build-push-controller.yml"

jobs:
build-and-push:
name: Build and Push Controller
runs-on: arc-runner-scale-set-dev0
timeout-minutes: 30
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Login to Amazon ECR
id: login-ecr
uses: aws-actions/amazon-ecr-login@v2
with:
registries: ${{ secrets.TOOLS_AWS_ACCOUNT_ID }}

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
with:
driver-opts: |
image=public.ecr.aws/vend/moby/buildkit:buildx-stable-1

- name: Determine image tag
id: tag
run: |
if [ -n "${{ inputs.tag }}" ]; then
echo "tag=${{ inputs.tag }}" >> "$GITHUB_OUTPUT"
else
echo "tag=${{ github.sha }}" >> "$GITHUB_OUTPUT"
fi

- name: Build and push
uses: docker/build-push-action@v6
with:
context: .
file: Dockerfile
push: true
platforms: linux/amd64,linux/arm64
tags: |
${{ steps.login-ecr.outputs.registry }}/agent-sandbox-controller-fork:${{ steps.tag.outputs.tag }}
cache-from: type=gha
cache-to: type=gha,mode=max