diff --git a/.github/workflows/build-oci.yaml b/.github/workflows/build-oci.yaml new file mode 100644 index 0000000..bef883e --- /dev/null +++ b/.github/workflows/build-oci.yaml @@ -0,0 +1,37 @@ +name: Build OCI image + +on: + release: + types: + - published + +env: + REGISTRY: ghcr.io + IMAGE_NAME: ${{ github.repository }} + +jobs: + build: + runs-on: ubuntu-latest + steps: + - name: Checkout repository + uses: actions/checkout@v4 + - name: Log in to the Container registry + uses: docker/login-action@65b78e6e13532edd9afa3aa52ac7964289d1a9c1 + with: + registry: ${{ env.REGISTRY }} + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + - name: Set up QEMU + uses: docker/setup-qemu-action@v3 + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + - name: Build and push + uses: docker/build-push-action@v6 + with: + context: . + file: ./oci/katenary/Containerfile + push: true + tags: ${{ steps.meta.outputs.tags }} + labels: ${{ steps.meta.outputs.labels }} + build-args: | + VERSION=${{github.ref_name}} diff --git a/.gitignore b/.gitignore index 0fe6554..972ace2 100644 --- a/.gitignore +++ b/.gitignore @@ -30,3 +30,4 @@ __pycache__ # local binaries katenary !cmd/katenary +!oci/katenary diff --git a/oci/katenary/Containerfile b/oci/katenary/Containerfile new file mode 100644 index 0000000..1ad4387 --- /dev/null +++ b/oci/katenary/Containerfile @@ -0,0 +1,15 @@ +ARG GOVERSION=1.24 + +FROM docker.io/golang:${GOVERSION} AS builder +ARG VERSION=master +RUN set -xe; \ + CGO_ENABLED=0 go install -v github.com/katenary/katenary/cmd/katenary@$VERSION; + +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/bin/katenary /usr/local/bin/katenary +VOLUME /project +WORKDIR /project +ENTRYPOINT ["/usr/local/bin/katenary"]