Features/buildah build (#159)

* feat(oci): Build using pure Buildah
This commit is contained in:
2025-08-13 10:20:48 +02:00
committed by GitHub
parent 90eda75219
commit 9f75f874d1
2 changed files with 26 additions and 22 deletions

View File

@@ -1,4 +1,4 @@
name: Build OCI image name: Build and push OCI image
on: on:
push: push:
@@ -8,32 +8,36 @@ on:
env: env:
REGISTRY: ghcr.io REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }} IMAGE_NAME: ${{ github.repository }}
VERSION: ${{ github.ref_name }}
jobs: jobs:
build: build:
runs-on: ubuntu-latest runs-on: ubuntu-latest
permissions: permissions:
packages: write
contents: read contents: read
packages: write
steps: steps:
- name: Checkout repository - name: Checkout repository
uses: actions/checkout@v4 uses: actions/checkout@v4
- name: Build image
id: build-image - name: Install Buildah
uses: redhat-actions/buildah-build@v2 run: |-
with: if ! comamnd -v buildah 2>/dev/null; then
image: ghcr.io/katenary/katenary echo "Install Buildah"
tags: latest ${{ github.ref_name }} sudo apt-get update
containerfiles: | sudo apt-get install -y buildah
./oci/katenary/Containerfile else
build-args: | echo "Buildah already installed"
VERSION=${{ github.ref_name }} fi
- name: Build and tag
run: |-
buildah build --build-arg VERSION=$VERSION -t katenary -f ./oci/katenary/Containerfile .
buildah tag katenary $REGISTRY/${IMAGE_NAME,,}:$VERSION
buildah tag katenary $REGISTRY/${IMAGE_NAME,,}:latest
- name: Push image - name: Push image
id: push-to-quay run: |-
uses: redhat-actions/push-to-registry@v2 buildah login $REGISTRY -u ${{ github.actor }} -p ${{ secrets.GITHUB_TOKEN }}
with: buildah push $REGISTRY/${IMAGE_NAME,,}:$VERSION
image: ${{ steps.build-image.outputs.image }} buildah push $REGISTRY/${IMAGE_NAME,,}:latest
tags: ${{ steps.build-image.outputs.tags }}
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

View File

@@ -20,7 +20,7 @@ FROM scratch
LABEL org.opencontainers.image.source=https://github.com/katenary/katenary LABEL org.opencontainers.image.source=https://github.com/katenary/katenary
LABEL org.opencontainers.image.description="Katenary converts compose files to Helm Chart" LABEL org.opencontainers.image.description="Katenary converts compose files to Helm Chart"
LABEL org.opencontainers.image.licenses=MIT LABEL org.opencontainers.image.licenses=MIT
COPY --from=builder /go/src/github.com/katenary/katenary/katenary /usr/local/bin/katenary COPY --from=builder /go/src/github.com/katenary/katenary/katenary /katenary
VOLUME /project VOLUME /project
WORKDIR /project WORKDIR /project
ENTRYPOINT ["/usr/local/bin/katenary"] ENTRYPOINT ["/katenary"]