From 0286b82e52e3903999cbb8754379e1786fe30c89 Mon Sep 17 00:00:00 2001 From: james58899 Date: Fri, 15 Mar 2024 11:02:47 +0000 Subject: [PATCH] Pack docker image from binary --- .github/workflows/docker-publish.yml | 32 ++++++++++++++++++++++++---- 1 file changed, 28 insertions(+), 4 deletions(-) diff --git a/.github/workflows/docker-publish.yml b/.github/workflows/docker-publish.yml index 10f589a..c8e6486 100644 --- a/.github/workflows/docker-publish.yml +++ b/.github/workflows/docker-publish.yml @@ -15,7 +15,10 @@ env: IMAGE_NAME: ${{ github.repository }} jobs: - build: + Build: + uses: ./.github/workflows/build.yml + Docker: + needs: Build runs-on: ubuntu-latest permissions: contents: read @@ -24,8 +27,29 @@ jobs: # with sigstore/fulcio when running outside of PRs. id-token: write steps: - - name: Checkout repository - uses: actions/checkout@v4 + - name: Create Dockerfile + run: | + cat < Dockerfile + # syntax=docker/dockerfile:1 + FROM scratch as binary-amd64 + COPY hath-rust-aarch64-unknown-linux-gnu /hath-rust + + FROM scratch as binary-arm64 + COPY hath-rust-aarch64-unknown-linux-gnu /hath-rust + + FROM scratch as binary-arm + COPY hath-rust-armv7-unknown-linux-gnueabihf /hath-rust + + FROM debian:bookworm-slim + WORKDIR /hath + COPY --from=binary-$TARGETARCH --chmod=755 /hath-rust /usr/local/bin/hath-rust + CMD ["hath-rust"] + EOF + + - name: Download artifact + uses: actions/download-artifact@v4 + with: + path: artifacts # Install the cosign tool except on PR # https://github.com/sigstore/cosign-installer @@ -66,7 +90,7 @@ jobs: uses: docker/build-push-action@v5 with: context: . - platforms: linux/amd64,linux/arm64 + platforms: linux/amd64,linux/arm64,linux/arm/v7 push: ${{ github.event_name != 'pull_request' }} tags: ${{ steps.meta.outputs.tags }} labels: ${{ steps.meta.outputs.labels }}