2020-12-09 06:06:37 +00:00
|
|
|
name: docker
|
|
|
|
|
|
|
|
on:
|
|
|
|
push:
|
|
|
|
branches:
|
|
|
|
- unstable
|
|
|
|
- stable
|
|
|
|
|
|
|
|
env:
|
|
|
|
DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }}
|
|
|
|
DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }}
|
2021-07-21 03:24:23 +00:00
|
|
|
IMAGE_NAME: ${{ github.repository_owner}}/lighthouse
|
|
|
|
LCLI_IMAGE_NAME: ${{ github.repository_owner }}/lcli
|
2020-12-09 06:06:37 +00:00
|
|
|
|
|
|
|
jobs:
|
|
|
|
extract-branch-name:
|
2020-12-11 00:19:35 +00:00
|
|
|
runs-on: ubuntu-18.04
|
2020-12-09 06:06:37 +00:00
|
|
|
steps:
|
|
|
|
- name: Extract branch name
|
|
|
|
run: echo "::set-output name=BRANCH_NAME::$(echo ${GITHUB_REF#refs/heads/})"
|
|
|
|
id: extract_branch
|
|
|
|
outputs:
|
|
|
|
BRANCH_NAME: ${{ steps.extract_branch.outputs.BRANCH_NAME }}
|
|
|
|
build-docker-arm64:
|
2020-12-11 00:19:35 +00:00
|
|
|
runs-on: ubuntu-18.04
|
2020-12-09 06:06:37 +00:00
|
|
|
needs: [extract-branch-name]
|
2020-12-11 00:19:35 +00:00
|
|
|
# We need to enable experimental docker features in order to use `docker buildx`
|
|
|
|
env:
|
|
|
|
DOCKER_CLI_EXPERIMENTAL: enabled
|
2020-12-09 06:06:37 +00:00
|
|
|
steps:
|
|
|
|
- uses: actions/checkout@v2
|
2021-02-15 06:09:54 +00:00
|
|
|
- name: Update Rust
|
|
|
|
run: rustup update stable
|
2020-12-09 06:06:37 +00:00
|
|
|
- name: Dockerhub login
|
|
|
|
run: |
|
|
|
|
echo "${DOCKER_PASSWORD}" | docker login --username ${DOCKER_USERNAME} --password-stdin
|
|
|
|
- name: Cross build lighthouse binary
|
2021-01-19 03:50:10 +00:00
|
|
|
run: |
|
|
|
|
cargo install cross
|
|
|
|
make build-aarch64-portable
|
2020-12-09 06:06:37 +00:00
|
|
|
- name: Move cross-built ARM binary into Docker scope
|
|
|
|
run: |
|
|
|
|
mkdir ./bin;
|
|
|
|
mv ./target/aarch64-unknown-linux-gnu/release/lighthouse ./bin;
|
|
|
|
- name: Set Env
|
|
|
|
if: needs.extract-branch-name.outputs.BRANCH_NAME == 'unstable'
|
|
|
|
run: |
|
|
|
|
echo "TAG_SUFFIX=-unstable" >> $GITHUB_ENV;
|
2020-12-11 00:19:35 +00:00
|
|
|
# Install dependencies for emulation. Have to create a new builder to pick up emulation support.
|
2020-12-09 06:06:37 +00:00
|
|
|
- name: Build ARM64 dockerfile (with push)
|
|
|
|
run: |
|
2020-12-11 00:19:35 +00:00
|
|
|
docker run --privileged --rm tonistiigi/binfmt --install arm64
|
|
|
|
docker buildx create --use --name cross-builder
|
2020-12-09 06:06:37 +00:00
|
|
|
docker buildx build \
|
|
|
|
--platform=linux/arm64 \
|
|
|
|
--file ./Dockerfile.cross . \
|
2020-12-11 00:19:35 +00:00
|
|
|
--tag ${IMAGE_NAME}:latest-arm64${TAG_SUFFIX} \
|
|
|
|
--push
|
2020-12-09 06:06:37 +00:00
|
|
|
build-docker-amd64:
|
2020-12-11 00:19:35 +00:00
|
|
|
runs-on: ubuntu-18.04
|
2020-12-09 06:06:37 +00:00
|
|
|
needs: [extract-branch-name]
|
|
|
|
steps:
|
|
|
|
- uses: actions/checkout@v2
|
2021-02-15 06:09:54 +00:00
|
|
|
- name: Update Rust
|
|
|
|
run: rustup update stable
|
2020-12-09 06:06:37 +00:00
|
|
|
- name: Dockerhub login
|
|
|
|
run: |
|
|
|
|
echo "${DOCKER_PASSWORD}" | docker login --username ${DOCKER_USERNAME} --password-stdin
|
|
|
|
- name: Set Env
|
|
|
|
if: needs.extract-branch-name.outputs.BRANCH_NAME == 'unstable'
|
|
|
|
run: |
|
|
|
|
echo "TAG_SUFFIX=-unstable" >> $GITHUB_ENV;
|
|
|
|
- name: Build AMD64 dockerfile (with push)
|
|
|
|
run: |
|
|
|
|
docker build \
|
|
|
|
--build-arg PORTABLE=true \
|
|
|
|
--tag ${IMAGE_NAME}:latest-amd64${TAG_SUFFIX} \
|
|
|
|
--file ./Dockerfile .
|
|
|
|
docker push ${IMAGE_NAME}:latest-amd64${TAG_SUFFIX}
|
|
|
|
build-docker-multiarch:
|
2020-12-11 00:19:35 +00:00
|
|
|
runs-on: ubuntu-18.04
|
2020-12-09 06:06:37 +00:00
|
|
|
needs: [build-docker-arm64, build-docker-amd64, extract-branch-name]
|
2020-12-11 00:19:35 +00:00
|
|
|
# We need to enable experimental docker features in order to use `docker manifest`
|
|
|
|
env:
|
|
|
|
DOCKER_CLI_EXPERIMENTAL: enabled
|
2020-12-09 06:06:37 +00:00
|
|
|
steps:
|
|
|
|
- name: Dockerhub login
|
|
|
|
run: |
|
|
|
|
echo "${DOCKER_PASSWORD}" | docker login --username ${DOCKER_USERNAME} --password-stdin
|
|
|
|
- name: Set Env
|
|
|
|
if: needs.extract-branch-name.outputs.BRANCH_NAME == 'unstable'
|
|
|
|
run: |
|
|
|
|
echo "TAG_SUFFIX=-unstable" >> $GITHUB_ENV;
|
|
|
|
- name: Create and push multiarch manifest
|
|
|
|
run: |
|
|
|
|
docker manifest create ${IMAGE_NAME}:latest${TAG_SUFFIX} \
|
|
|
|
--amend ${IMAGE_NAME}:latest-arm64${TAG_SUFFIX} \
|
|
|
|
--amend ${IMAGE_NAME}:latest-amd64${TAG_SUFFIX};
|
|
|
|
docker manifest push ${IMAGE_NAME}:latest${TAG_SUFFIX}
|
2021-07-21 03:24:23 +00:00
|
|
|
build-docker-lcli:
|
|
|
|
runs-on: ubuntu-18.04
|
|
|
|
needs: [extract-branch-name]
|
|
|
|
steps:
|
|
|
|
- uses: actions/checkout@v2
|
|
|
|
- name: Dockerhub login
|
|
|
|
run: |
|
|
|
|
echo "${DOCKER_PASSWORD}" | docker login --username ${DOCKER_USERNAME} --password-stdin
|
|
|
|
- name: Set Env
|
|
|
|
if: needs.extract-branch-name.outputs.BRANCH_NAME == 'unstable'
|
|
|
|
run: |
|
|
|
|
echo "TAG_SUFFIX=-unstable" >> $GITHUB_ENV;
|
|
|
|
- name: Build lcli dockerfile (with push)
|
|
|
|
run: |
|
|
|
|
docker build \
|
|
|
|
--build-arg PORTABLE=true \
|
|
|
|
--tag ${LCLI_IMAGE_NAME}:latest${TAG_SUFFIX} \
|
|
|
|
--file ./lcli/Dockerfile .
|
|
|
|
docker push ${LCLI_IMAGE_NAME}:latest${TAG_SUFFIX}
|