From 209e5f52d028c2f96c8e66d4acb9d5ee6a5509e8 Mon Sep 17 00:00:00 2001 From: erikarasnick Date: Wed, 28 Dec 2022 12:43:52 -0500 Subject: [PATCH 1/4] try multiplatform build on PR --- .github/workflows/build-deploy-pr.yaml | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/.github/workflows/build-deploy-pr.yaml b/.github/workflows/build-deploy-pr.yaml index 3d4252f..76efeea 100644 --- a/.github/workflows/build-deploy-pr.yaml +++ b/.github/workflows/build-deploy-pr.yaml @@ -12,7 +12,11 @@ jobs: fail-fast: false steps: - name: Checkout - uses: actions/checkout@v2 + uses: actions/checkout@v3 + - name: Set up QEMU + uses: docker/setup-qemu-action@v2 + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v2 - name: create latest tag variable run: | container="${{ env.registry }}/${{ env.username}}/${{ env.repository }}:latest" @@ -34,7 +38,12 @@ jobs: registry: ${{ env.registry }} username: ${{ env.username }} password: ${{ secrets.GITHUB_TOKEN }} - - name: deploy pull request container - run: | - docker tag ${{ env.container }} ${{ env.versioned }} - docker push ${{ env.versioned }} + - name: Build and push + uses: docker/build-push-action@v3 + with: + context: . + platforms: linux/amd64,linux/arm64 + push: true + tags: | + ${{ env.container }} ${{ env.versioned }} + ${{ env.versioned }} From bd52747d6cdec4755bf3e924e22c07ffe4f2b9ca Mon Sep 17 00:00:00 2001 From: erikarasnick Date: Wed, 28 Dec 2022 13:21:50 -0500 Subject: [PATCH 2/4] separate tags --- .github/workflows/build-deploy-pr.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build-deploy-pr.yaml b/.github/workflows/build-deploy-pr.yaml index 76efeea..6b899eb 100644 --- a/.github/workflows/build-deploy-pr.yaml +++ b/.github/workflows/build-deploy-pr.yaml @@ -45,5 +45,5 @@ jobs: platforms: linux/amd64,linux/arm64 push: true tags: | - ${{ env.container }} ${{ env.versioned }} + ${{ env.container }} ${{ env.versioned }} ${{ env.versioned }} From 69f0216494a83a9ab8b76bef7dc6326709d0c786 Mon Sep 17 00:00:00 2001 From: erikarasnick Date: Wed, 28 Dec 2022 13:48:54 -0500 Subject: [PATCH 3/4] try again --- .github/workflows/build-deploy-pr.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build-deploy-pr.yaml b/.github/workflows/build-deploy-pr.yaml index 6b899eb..8de8b6d 100644 --- a/.github/workflows/build-deploy-pr.yaml +++ b/.github/workflows/build-deploy-pr.yaml @@ -45,5 +45,5 @@ jobs: platforms: linux/amd64,linux/arm64 push: true tags: | - ${{ env.container }} ${{ env.versioned }} + ${{ env.container }} ${{ env.versioned }} From 046fedc81118176f94bce6ed29c2eb78ddcc2da6 Mon Sep 17 00:00:00 2001 From: erikarasnick Date: Wed, 28 Dec 2022 18:11:26 -0500 Subject: [PATCH 4/4] build vs target platform in Dockerfile --- Dockerfile | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index d321e39..3dfaaba 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,4 @@ -FROM rocker/r-ver:4.1.2 +FROM --platform=$BUILDPLATFORM rocker/r-ver:4.1.2 ENV degauss_name="fortunes" ENV degauss_version="0.1.3" @@ -38,3 +38,10 @@ COPY entrypoint.R . WORKDIR /tmp ENTRYPOINT ["/app/entrypoint.R"] + +ARG TARGETPLATFORM +RUN compile --target=$TARGETPLATFORM -o /out/mybinary + +FROM rocker/r-ver:4.1.2 +COPY --from=build /out/mybinary /bin +