Skip to content

Build and Push Preview Docker Image #16

Build and Push Preview Docker Image

Build and Push Preview Docker Image #16

name: Build and Push Preview Docker Image
permissions:
contents: read
packages: write
concurrency:
group: docker-ci-${{ github.event.workflow_run.head_branch }}
cancel-in-progress: true
on:
workflow_run:
workflows: ["CI"]
types: [completed]
branches: [main]
env:
GO_VERSION: "1.24.3"
NODE_VERSION: "24"
jobs:
docker:
name: Build Docker Image
runs-on: ubuntu-latest
# Only run if the triggering CI workflow concluded successfully
if: ${{ github.event.workflow_run.conclusion == 'success' }}
steps:
- name: Checkout code (commit from CI run)
uses: actions/checkout@v4
with:
ref: ${{ github.event.workflow_run.head_sha }}
- 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
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- uses: pnpm/action-setup@v4
with:
version: 10
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: ${{ env.NODE_VERSION }}
cache: "pnpm"
cache-dependency-path: ui/pnpm-lock.yaml
- name: Setup Go
uses: actions/setup-go@v5
with:
go-version: ${{ env.GO_VERSION }}
cache: true
- name: Install deps
run: make deps
- name: Generate tags
id: tags
run: |
echo "tags=ghcr.io/${{ github.repository_owner }}/kite:main" >> $GITHUB_OUTPUT
echo "image_tag=main" >> $GITHUB_OUTPUT
- name: Build
run: make cross-compile
- name: Build and push Docker image
uses: docker/build-push-action@v6
with:
context: .
file: ./Dockerfile.binary
push: true
tags: ${{ steps.tags.outputs.tags }}
labels: runnumber=${{ github.run_id }}
cache-from: type=gha
cache-to: type=gha,mode=max
platforms: linux/amd64,linux/arm64