diff --git a/.github/workflows/build-push-image-commit.yaml b/.github/workflows/build-push-image-commit.yaml index 55308a7..33d251c 100644 --- a/.github/workflows/build-push-image-commit.yaml +++ b/.github/workflows/build-push-image-commit.yaml @@ -5,6 +5,7 @@ on: push: branches: - main + jobs: build_push_image: runs-on: ubuntu-latest @@ -12,26 +13,17 @@ jobs: - name: Checkout uses: actions/checkout@v2 - - name: Install go 1.16 - uses: actions/setup-go@v2 - with: - go-version: 1.16 + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v2 - - name: Login to Quay.io Hub - uses: docker/login-action@v1 + - name: Build & push Docker image + uses: mr-smithers-excellent/docker-build-push@v6 with: + image: snowdrop/cert-manager-webhook-godaddy + addLatest: true + enableBuildKit: true + multiPlatform: true + platform: linux/amd64,linux/arm64 registry: quay.io username: ${{ secrets.QUAY_ROBOT_USER }} - password: ${{ secrets.QUAY_ROBOT_TOKEN }} - - - name: Build the container image - run: | - VERSION=$(git rev-parse --short HEAD 2>/dev/null) - docker build -t cert-manager-webhook-godaddy:${VERSION} -f Dockerfile . - - TAG_ID=$(docker images -q cert-manager-webhook-godaddy:${VERSION}) - docker tag ${TAG_ID} quay.io/snowdrop/cert-manager-webhook-godaddy:${VERSION} - docker tag ${TAG_ID} quay.io/snowdrop/cert-manager-webhook-godaddy:latest - - docker push quay.io/snowdrop/cert-manager-webhook-godaddy:${VERSION} - docker push quay.io/snowdrop/cert-manager-webhook-godaddy:latest \ No newline at end of file + password: ${{ secrets.QUAY_ROBOT_TOKEN }} \ No newline at end of file diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index f3dea14..bbb58d7 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -52,21 +52,37 @@ jobs: echo "TAG_VERSION=${TAG_VERSION}" >> "${GITHUB_OUTPUT}" - - name: Login to Quay.io Hub - uses: docker/login-action@v1 + # - name: Login to Quay.io Hub + # uses: docker/login-action@v1 + # with: + # registry: quay.io + # username: ${{ secrets.QUAY_ROBOT_USER }} + # password: ${{ secrets.QUAY_ROBOT_TOKEN }} + # + # - name: Build the container image + # run: | + # NEW_VERSION="${{ steps.tag-chart.outputs.TAG_VERSION }}" + # docker build -t cert-manager-webhook-godaddy:${NEW_VERSION} -f Dockerfile . + # + # TAG_ID=$(docker images -q cert-manager-webhook-godaddy:${NEW_VERSION}) + # docker tag ${TAG_ID} quay.io/snowdrop/cert-manager-webhook-godaddy:${NEW_VERSION} + # docker push quay.io/snowdrop/cert-manager-webhook-godaddy:${NEW_VERSION} + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v2 + + - name: Build & push Docker image + uses: mr-smithers-excellent/docker-build-push@v6 with: + image: snowdrop/cert-manager-webhook-godaddy + addLatest: true + enableBuildKit: true + multiPlatform: true + platform: linux/amd64,linux/arm64 registry: quay.io username: ${{ secrets.QUAY_ROBOT_USER }} password: ${{ secrets.QUAY_ROBOT_TOKEN }} - - name: Build the container image - run: | - NEW_VERSION="${{ steps.tag-chart.outputs.TAG_VERSION }}" - docker build -t cert-manager-webhook-godaddy:${NEW_VERSION} -f Dockerfile . - - TAG_ID=$(docker images -q cert-manager-webhook-godaddy:${NEW_VERSION}) - docker tag ${TAG_ID} quay.io/snowdrop/cert-manager-webhook-godaddy:${NEW_VERSION} - docker push quay.io/snowdrop/cert-manager-webhook-godaddy:${NEW_VERSION} - name: Run chart-releaser uses: helm/chart-releaser-action@v1.5.0 diff --git a/Dockerfile b/Dockerfile index dfd26d6..eb5f6b1 100644 --- a/Dockerfile +++ b/Dockerfile @@ -4,7 +4,9 @@ WORKDIR /go/src/webhook-app COPY . . RUN --mount=type=cache,target=$HOME/go/pkg/mod go mod download -RUN CGO_ENABLED=0 go build -o /webhook-app -ldflags '-w -extldflags "-static"' . +ARG TARGETOS +ARG TARGETARCH +RUN CGO_ENABLED=0 GOOS=${TARGETOS} GOARCH=${TARGETARCH} go build -o /webhook-app -ldflags '-w -extldflags "-static"' . FROM alpine:3 diff --git a/README.md b/README.md index baf4fbd..f28c5b5 100644 --- a/README.md +++ b/README.md @@ -3,6 +3,7 @@ Table of Contents ================= * [Introduction](#introduction) + * [Paltform](#platform) * [Installation](#installation) * [Cert Manager](#cert-manager) * [The Godaddy webhook](#the-godaddy-webhook) @@ -30,6 +31,10 @@ This project supports the following versions of the certificate manager: **Remark**: The Helm chart `AppVersion` like the image `version` are tagged according to the version used to release this project: v0.1.0, v0.2.0. When using the main branch, the Helm chart will install the latest image pushed on [quay.io](https://quay.io/repository/snowdrop/cert-manager-webhook-godaddy) +## Platform + +The image built supports as Arch: am64 and arm64 since release `>= 0.2.0` + ## Installation ### Cert Manager