Update the docker build to include features based images (#3875)

## Proposed Changes

There are some features that are enabled/disabled with the `FEATURES` env variable. This PR would introduce a pattern to introduce docker images based on those features. This can be useful later on to have specific images for some experimental features in the future.

## Additional Info

We at Lodesart need to have `minimal` spec support for some cross-client network testing. To make it efficient on the CI, we tend to use minimal preset.
This commit is contained in:
Nazar Hussain
2023-02-08 02:18:51 +00:00
parent 9547ac069c
commit 7934485aef
2 changed files with 17 additions and 4 deletions

View File

@@ -43,7 +43,7 @@ jobs:
VERSION: ${{ env.VERSION }} VERSION: ${{ env.VERSION }}
VERSION_SUFFIX: ${{ env.VERSION_SUFFIX }} VERSION_SUFFIX: ${{ env.VERSION_SUFFIX }}
build-docker-single-arch: build-docker-single-arch:
name: build-docker-${{ matrix.binary }} name: build-docker-${{ matrix.binary }}${{ matrix.features.version_suffix }}
runs-on: ubuntu-22.04 runs-on: ubuntu-22.04
strategy: strategy:
matrix: matrix:
@@ -51,6 +51,10 @@ jobs:
aarch64-portable, aarch64-portable,
x86_64, x86_64,
x86_64-portable] x86_64-portable]
features: [
{version_suffix: "", env: ""},
{version_suffix: "-dev", env: "spec-minimal"}
]
include: include:
- profile: maxperf - profile: maxperf
@@ -60,6 +64,8 @@ jobs:
DOCKER_CLI_EXPERIMENTAL: enabled DOCKER_CLI_EXPERIMENTAL: enabled
VERSION: ${{ needs.extract-version.outputs.VERSION }} VERSION: ${{ needs.extract-version.outputs.VERSION }}
VERSION_SUFFIX: ${{ needs.extract-version.outputs.VERSION_SUFFIX }} VERSION_SUFFIX: ${{ needs.extract-version.outputs.VERSION_SUFFIX }}
FEATURE_SUFFIX: ${{ matrix.features.version_suffix }}
FEATURES: ${{ matrix.features.env }}
steps: steps:
- uses: actions/checkout@v3 - uses: actions/checkout@v3
- name: Update Rust - name: Update Rust
@@ -98,7 +104,8 @@ jobs:
docker buildx build \ docker buildx build \
--platform=linux/${SHORT_ARCH} \ --platform=linux/${SHORT_ARCH} \
--file ./Dockerfile.cross . \ --file ./Dockerfile.cross . \
--tag ${IMAGE_NAME}:${VERSION}-${SHORT_ARCH}${VERSION_SUFFIX}${MODERNITY_SUFFIX} \ --tag ${IMAGE_NAME}:${VERSION}-${SHORT_ARCH}${VERSION_SUFFIX}${MODERNITY_SUFFIX}${FEATURE_SUFFIX} \
--build-arg FEATURES=${FEATURES} \
--provenance=false \ --provenance=false \
--push --push
build-docker-multiarch: build-docker-multiarch:

View File

@@ -57,7 +57,7 @@ $ docker pull sigp/lighthouse:latest-modern
Image tags follow this format: Image tags follow this format:
``` ```
${version}${arch}${stability}${modernity} ${version}${arch}${stability}${modernity}${features}
``` ```
The `version` is: The `version` is:
@@ -81,6 +81,12 @@ The `modernity` is:
* `-modern` for optimized builds * `-modern` for optimized builds
* empty for a `portable` unoptimized build * empty for a `portable` unoptimized build
The `features` is:
* `-dev` for a development build with `minimal-spec` preset enabled.
* empty for a standard build with no custom feature enabled.
Examples: Examples:
* `latest-unstable-modern`: most recent `unstable` build for all modern CPUs (x86_64 or ARM) * `latest-unstable-modern`: most recent `unstable` build for all modern CPUs (x86_64 or ARM)