Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added platform arg to docker build #182

Closed
wants to merge 1 commit into from

Conversation

drpayyne
Copy link

@drpayyne drpayyne commented Sep 7, 2021

Hi @jlandure, thanks a lot for your work!

Here's my PR to open discussion for publishing multi-arch images:

https://www.docker.com/blog/multi-arch-build-and-images-the-simple-way/ has a quick guide on what I propose. The docker buildx way. I have been testing this out and using this extensively to publish multi-arch image to multiple registries.

Suggestion - what about using GitHub Actions to publish multi-arch multi-registry images? Here's my repo which implements it this way - https://github.com/drpayyne/docker-php. There's a single workflow file for each package and I build for both linux/arm64 and linux/amd64 and publish it to both DockerHub and GitHub Packages.

This is a draft PR which I intend to take forward in your preferred way of action. Please let me know how we can do this. From a quick overview, only the Deno Dockerfile needs a little modification to get it to work multi-platform. We need to pick the appropriate Deno download URL based on the target architecture. A preview of how it would be is implemented by me for another repo at https://github.com/markshust/docker-magento/pull/516/files

@drpayyne drpayyne mentioned this pull request Sep 7, 2021
@Ferror
Copy link

Ferror commented Mar 11, 2022

Go ahead and use mine pipeline.

   
name: Build & Publish Docker Image

on:
    push:

jobs:
    build:
        runs-on: ubuntu-latest
        steps:
            -
                name: checkout code
                uses: actions/checkout@v2
            -
                name: Login to Docker Hub
                uses: docker/login-action@v1
                with:
                    username: ${{ secrets.DOCKER_HUB_USERNAME }}
                    password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }}
            -
                name: install buildx
                id: buildx
                uses: crazy-max/ghaction-docker-buildx@v1
                with:
                    buildx-version: latest
            -
                name: build the image
                run: |
                    docker buildx build \
                        --push \
                        --tag ${{ secrets.DOCKER_HUB_USERNAME }}/REPO-NAME:TAG \
                        --platform linux/amd64,linux/arm/v7,linux/arm64 .

@jlandure
Copy link
Member

Hi there 👋

I am investigating your proposal and buildx
I will publish new images soon. 😊
And sorry for the delay.

@Ferror
Copy link

Ferror commented Apr 28, 2022

@jlandure any updates regarding linux/arm64 image?

@@ -1,4 +1,4 @@
#!/bin/bash
set -e

docker image build --build-arg VCS_REF=`git rev-parse --short HEAD` --build-arg BUILD_DATE=`date -u +”%Y-%m-%dT%H:%M:%SZ”` -t $IMAGE_NAME .
docker image build --build-arg VCS_REF=`git rev-parse --short HEAD` --platform linux/arm64,linux/amd64 --build-arg BUILD_DATE=`date -u +”%Y-%m-%dT%H:%M:%SZ”` -t $IMAGE_NAME .
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't it be?

Suggested change
docker image build --build-arg VCS_REF=`git rev-parse --short HEAD` --platform linux/arm64,linux/amd64 --build-arg BUILD_DATE=`date -u +”%Y-%m-%dT%H:%M:%SZ”` -t $IMAGE_NAME .
docker buildx build --build-arg VCS_REF=`git rev-parse --short HEAD` --platform linux/arm64,linux/amd64 --build-arg BUILD_DATE=`date -u +”%Y-%m-%dT%H:%M:%SZ”` -t $IMAGE_NAME .

@hgwood
Copy link
Member

hgwood commented Jun 7, 2022

Hi @drpayyne! Your change has been included in #201. Thank you very much.

@hgwood hgwood closed this Jun 7, 2022
@drpayyne
Copy link
Author

drpayyne commented Jun 7, 2022

Thank you @hgwood and @zigarn! Apologies that I missed the PR comment notification.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants