mirror of
https://github.com/sigp/lighthouse.git
synced 2026-03-03 00:31:50 +00:00
Optimized Docker images (#2966)
## Issue Addressed Closes #2938 ## Proposed Changes * Build and publish images with a `-modern` suffix which enable CPU optimizations for modern hardware. * Add docs for the plethora of available images! * Unify all the Docker workflows in `docker.yml` (including for tagged releases). ## Additional Info The `Dockerfile` is no longer used by our Docker Hub builds, as we use `cross` and a generic approach for ARM and x86. There's a new CI job `docker-build-from-source` which tests the `Dockerfile` without publishing anything.
This commit is contained in:
68
.github/workflows/release.yml
vendored
68
.github/workflows/release.yml
vendored
@@ -20,74 +20,6 @@ jobs:
|
||||
id: extract_version
|
||||
outputs:
|
||||
VERSION: ${{ steps.extract_version.outputs.VERSION }}
|
||||
|
||||
build-docker-arm64:
|
||||
runs-on: ubuntu-18.04
|
||||
needs: [extract-version]
|
||||
# We need to enable experimental docker features in order to use `docker buildx`
|
||||
env:
|
||||
DOCKER_CLI_EXPERIMENTAL: enabled
|
||||
VERSION: ${{ needs.extract-version.outputs.VERSION }}
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- name: Update Rust
|
||||
run: rustup update stable
|
||||
- name: Dockerhub login
|
||||
run: |
|
||||
echo "${DOCKER_PASSWORD}" | docker login --username ${DOCKER_USERNAME} --password-stdin
|
||||
- name: Cross build lighthouse binary
|
||||
run: |
|
||||
cargo install cross
|
||||
make build-aarch64-portable
|
||||
- name: Move cross-built ARM binary into Docker scope
|
||||
run: |
|
||||
mkdir ./bin;
|
||||
mv ./target/aarch64-unknown-linux-gnu/release/lighthouse ./bin;
|
||||
# Install dependencies for emulation. Have to create a new builder to pick up emulation support.
|
||||
- name: Build ARM64 dockerfile (with push)
|
||||
run: |
|
||||
docker run --privileged --rm tonistiigi/binfmt --install arm64
|
||||
docker buildx create --use --name cross-builder
|
||||
docker buildx build \
|
||||
--platform=linux/arm64 \
|
||||
--file ./Dockerfile.cross . \
|
||||
--tag ${IMAGE_NAME}:${{ env.VERSION }}-arm64 \
|
||||
--push
|
||||
build-docker-amd64:
|
||||
runs-on: ubuntu-18.04
|
||||
needs: [extract-version]
|
||||
env:
|
||||
DOCKER_CLI_EXPERIMENTAL: enabled
|
||||
VERSION: ${{ needs.extract-version.outputs.VERSION }}
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- name: Dockerhub login
|
||||
run: |
|
||||
echo "${DOCKER_PASSWORD}" | docker login --username ${DOCKER_USERNAME} --password-stdin
|
||||
- name: Build AMD64 dockerfile (with push)
|
||||
run: |
|
||||
docker build \
|
||||
--build-arg PORTABLE=true \
|
||||
--tag ${IMAGE_NAME}:${{ env.VERSION }}-amd64 \
|
||||
--file ./Dockerfile .
|
||||
docker push ${IMAGE_NAME}:${{ env.VERSION }}-amd64
|
||||
build-docker-multiarch:
|
||||
runs-on: ubuntu-18.04
|
||||
needs: [build-docker-arm64, build-docker-amd64, extract-version]
|
||||
# We need to enable experimental docker features in order to use `docker manifest`
|
||||
env:
|
||||
DOCKER_CLI_EXPERIMENTAL: enabled
|
||||
VERSION: ${{ needs.extract-version.outputs.VERSION }}
|
||||
steps:
|
||||
- name: Dockerhub login
|
||||
run: |
|
||||
echo "${DOCKER_PASSWORD}" | docker login --username ${DOCKER_USERNAME} --password-stdin
|
||||
- name: Create and push multiarch manifest
|
||||
run: |
|
||||
docker manifest create ${IMAGE_NAME}:${{ env.VERSION }} \
|
||||
--amend ${IMAGE_NAME}:${{ env.VERSION }}-arm64 \
|
||||
--amend ${IMAGE_NAME}:${{ env.VERSION }}-amd64;
|
||||
docker manifest push ${IMAGE_NAME}:${{ env.VERSION }}
|
||||
build:
|
||||
name: Build Release
|
||||
strategy:
|
||||
|
||||
Reference in New Issue
Block a user