Build Docker Image #222
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: Haiven Community Knowledge Pack Workflow | |
run-name: Build Docker Image | |
env: | |
REGISTRY: "ghcr.io" | |
on: | |
push: | |
workflow_dispatch: # allows for manual invocation | |
repository_dispatch: | |
types: [haiven-base-new] | |
jobs: | |
Build: | |
if: github.ref == 'refs/heads/main' | |
runs-on: ubuntu-latest | |
permissions: | |
contents: 'read' | |
packages: 'write' | |
steps: | |
- uses: 'actions/checkout@v4.1.1' | |
with: | |
lfs: true | |
- name: Log in to the Container registry | |
uses: docker/login-action@v3 | |
with: | |
registry: ${{ env.REGISTRY }} | |
username: ${{ github.actor }} | |
# TODO: Can we switch to GITHUB_TOKEN once haiven repo is public? | |
# GH_REGISTRY_TOKEN needs read and write access to packages, to both pull the base image and then push the new image later | |
password: ${{ secrets.GH_REGISTRY_TOKEN }} | |
- uses: docker/metadata-action@v5 | |
id: metadata | |
with: | |
images: ${{ env.REGISTRY }}/${{ github.repository }} | |
- name: Kaniko build community instance image | |
# if: steps.changes.outputs.build == 'true' | |
id: 'kaniko-community-instance' | |
uses: int128/kaniko-action@v1 | |
with: | |
tags: ${{ steps.metadata.outputs.tags }} | |
labels: ${{ steps.metadata.outputs.labels }} | |
cache: true | |
cache-repository: ${{ env.REGISTRY }}/${{ github.repository }}/cache | |
push: true | |
context: ./ | |
build-args: | | |
REGISTRY_URL=${{ env.REGISTRY }}/tw-haiven/ | |
TAG=main |