From 26274633660a372429abee7be4b0ae1f7c13c0e1 Mon Sep 17 00:00:00 2001 From: realbigsean Date: Fri, 4 Sep 2020 02:43:32 +0000 Subject: [PATCH] add a github action for build multi-arch docker images (#1574) ## Issue Addressed #1512 ## Proposed Changes Use Github Actions to automate the Docker image build, so that we can make a multi-arch image. ## Additional Info This change will require adding the DOCKER_USERNAME and DOCKER_PASSWORD secrets in Github. It will also require disabling the Docker Hub automated build. --- .github/workflows/docker.yml | 42 ++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100644 .github/workflows/docker.yml diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml new file mode 100644 index 000000000..d03b95e8d --- /dev/null +++ b/.github/workflows/docker.yml @@ -0,0 +1,42 @@ +name: docker + +on: + push: + branches: + - master + +jobs: + build-docker-image: + runs-on: ubuntu-18.04 + steps: + - uses: actions/checkout@master + + - name: Dockerhub login + env: + DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }} + DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }} + run: | + echo "${DOCKER_PASSWORD}" | docker login --username ${DOCKER_USERNAME} --password-stdin + + - name: Build Docker Buildx + run: | + export DOCKER_BUILDKIT=1; + docker build --platform=local -o . git://github.com/docker/buildx; + mkdir -p ~/.docker/cli-plugins; + mv buildx ~/.docker/cli-plugins/docker-buildx; + + - name: Create Docker Builder + run: | + docker run --rm --privileged multiarch/qemu-user-static --reset -p yes; + docker context create node-amd64; + docker context create node-arm64; + docker buildx create --use --name lighthouse node-amd64; + docker buildx create --append --name lighthouse node-arm64; + + - name: Build dockerfile (with push) + run: | + docker buildx build \ + --platform=linux/amd64,linux/arm64 \ + --output "type=image,push=true" \ + --file ./Dockerfile . \ + --tag sigp/lighthouse:latest