diff --git a/.github/workflows/build-deploy-pr.yaml b/.github/workflows/build-deploy-pr.yaml index 3d4252f..8de8b6d 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 }} 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 +