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.
This commit is contained in:
parent
9c9176c1d1
commit
2627463366
42
.github/workflows/docker.yml
vendored
Normal file
42
.github/workflows/docker.yml
vendored
Normal file
@ -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
|
Loading…
Reference in New Issue
Block a user