Skip to content

Commit

Permalink
add a github action for build multi-arch docker images (#1574)
Browse files Browse the repository at this point in the history
## 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.
  • Loading branch information
realbigsean committed Sep 4, 2020
1 parent 9c9176c commit 2627463
Showing 1 changed file with 42 additions and 0 deletions.
42 changes: 42 additions & 0 deletions .github/workflows/docker.yml
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit 2627463

Please sign in to comment.