From 9f75f874d1424472b523cedd7e8bc19c6d651440 Mon Sep 17 00:00:00 2001 From: Patrice Ferlet Date: Wed, 13 Aug 2025 10:20:48 +0200 Subject: [PATCH] Features/buildah build (#159) * feat(oci): Build using pure Buildah --- .github/workflows/build-oci.yaml | 44 +++++++++++++++++--------------- oci/katenary/Containerfile | 4 +-- 2 files changed, 26 insertions(+), 22 deletions(-) diff --git a/.github/workflows/build-oci.yaml b/.github/workflows/build-oci.yaml index e478308..f7015aa 100644 --- a/.github/workflows/build-oci.yaml +++ b/.github/workflows/build-oci.yaml @@ -1,4 +1,4 @@ -name: Build OCI image +name: Build and push OCI image on: push: @@ -8,32 +8,36 @@ on: env: REGISTRY: ghcr.io IMAGE_NAME: ${{ github.repository }} + VERSION: ${{ github.ref_name }} jobs: build: runs-on: ubuntu-latest permissions: - packages: write contents: read + packages: write steps: - name: Checkout repository uses: actions/checkout@v4 - - name: Build image - id: build-image - uses: redhat-actions/buildah-build@v2 - with: - image: ghcr.io/katenary/katenary - tags: latest ${{ github.ref_name }} - containerfiles: | - ./oci/katenary/Containerfile - build-args: | - VERSION=${{ github.ref_name }} + + - name: Install Buildah + run: |- + if ! comamnd -v buildah 2>/dev/null; then + echo "Install Buildah" + sudo apt-get update + sudo apt-get install -y buildah + else + echo "Buildah already installed" + 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 - id: push-to-quay - uses: redhat-actions/push-to-registry@v2 - with: - image: ${{ steps.build-image.outputs.image }} - tags: ${{ steps.build-image.outputs.tags }} - registry: ${{ env.REGISTRY }} - username: ${{ github.actor }} - password: ${{ secrets.GITHUB_TOKEN }} + run: |- + buildah login $REGISTRY -u ${{ github.actor }} -p ${{ secrets.GITHUB_TOKEN }} + buildah push $REGISTRY/${IMAGE_NAME,,}:$VERSION + buildah push $REGISTRY/${IMAGE_NAME,,}:latest diff --git a/oci/katenary/Containerfile b/oci/katenary/Containerfile index d570507..9837c7b 100644 --- a/oci/katenary/Containerfile +++ b/oci/katenary/Containerfile @@ -20,7 +20,7 @@ FROM scratch 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.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 WORKDIR /project -ENTRYPOINT ["/usr/local/bin/katenary"] +ENTRYPOINT ["/katenary"]