diff --git a/.github/workflows/docker-images.yml b/.github/workflows/docker-images.yml index 9ce8ce0469..693fbe5473 100644 --- a/.github/workflows/docker-images.yml +++ b/.github/workflows/docker-images.yml @@ -11,6 +11,12 @@ jobs: superchain: name: jsii/superchain runs-on: ubuntu-latest + strategy: + matrix: + node: ['10', '14'] + env: + # Node version whose images will be aliased to 'nightly' and 'latest' + DEFAULT_NODE_MAJOR_VERSION: 10 steps: - name: Check out uses: actions/checkout@v2 @@ -53,31 +59,45 @@ jobs: - name: Build Image if: steps.should-run.outputs.result == 'true' run: |- - docker build \ - --pull \ - --build-arg BUILD_TIMESTAMP="$(date -u +'%Y-%m-%dT%H:%M:%SZ')" \ - --build-arg COMMIT_ID='${{ github.sha }}' \ - --tag 'jsii/superchain:nightly' \ + docker build \ + --pull \ + --build-arg BUILD_TIMESTAMP="$(date -u +'%Y-%m-%dT%H:%M:%SZ')" \ + --build-arg COMMIT_ID='${{ github.sha }}' \ + --build-arg NODE_MAJOR_VERSION=${{ matrix.node }} \ + --tag "jsii/superchain:node${{ matrix.node }}-nightly" \ ./superchain - name: Test Image if: steps.should-run.outputs.result == 'true' run: |- - docker run \ - --rm \ - --tty \ - --network=host \ - -v${{ github.workspace }}:${{ github.workspace }} \ - -w${{ github.workspace }} \ - 'jsii/superchain:nightly' \ + docker run \ + --rm \ + --tty \ + --network=host \ + -v${{ github.workspace }}:${{ github.workspace }} \ + -w${{ github.workspace }} \ + "jsii/superchain:node${{ matrix.node }}-nightly" \ bash -c "yarn install --frozen-lockfile && yarn build && yarn test" # Only when puhsing to main/release from now on - name: Publish (nightly) if: steps.should-run.outputs.result == 'true' && github.event_name == 'push' && github.ref != 'refs/heads/release' run: |- - docker push jsii/superchain:nightly + docker push jsii/superchain:node${{ matrix.node }}-nightly + + # If the current version is the default version, also tag this with the unqualified ':nightly' label + if [[ "${{ matrix.node }}" == "$DEFAULT_NODE_MAJOR_VERSION" ]]; then + docker tag jsii/superchain:node${{ matrix.node }}-nightly jsii/superchain:nightly + docker push jsii/superchain:nightly + fi - name: Publish (latest) if: steps.should-run.outputs.result == 'true' && github.event_name == 'push' && github.ref == 'refs/heads/release' run: |- - docker tag jsii/superchain:nightly jsii/superchain:latest - docker push jsii/superchain:latest + # Alias 'nodeX-nightly's to 'nodeX', then push + docker tag jsii/superchain:node${{ matrix.node }}-nightly jsii/superchain:node${{ matrix.node }} + docker push jsii/superchain:node${{ matrix.node }} + + # If the current version is the default version, also tag this with the unqualified ':latest' label + if [[ "${{ matrix.node }}" == "$DEFAULT_NODE_MAJOR_VERSION" ]]; then + docker tag jsii/superchain:node${{ matrix.node }} jsii/superchain:latest + docker push jsii/superchain:latest + fi diff --git a/.mergify/config.yml b/.mergify/config.yml index 2f0cecc5a0..cab6bd1a58 100644 --- a/.mergify/config.yml +++ b/.mergify/config.yml @@ -30,7 +30,7 @@ pull_request_rules: - '#changes-requested-reviews-by=0' - status-success=Semantic Pull Request # Docker image validation - - status-success=jsii/superchain + - status-success~=^jsii/superchain # One test for each OS - status-success~=^Test \(ubuntu-.*$ - status-success~=^Test \(macos-.*$ @@ -79,7 +79,7 @@ pull_request_rules: - '#changes-requested-reviews-by=0' - status-success=Semantic Pull Request # Docker image validation - - status-success=jsii/superchain + - status-success~=^jsii/superchain # One test for each OS - status-success~=^Test \(ubuntu-.*$ - status-success~=^Test \(macos-.*$ @@ -128,7 +128,7 @@ pull_request_rules: - '#changes-requested-reviews-by=0' - status-success=Semantic Pull Request # Docker image validation - - status-success=jsii/superchain + - status-success~=^jsii/superchain # One test for each OS - status-success~=^Test \(ubuntu-.*$ - status-success~=^Test \(macos-.*$ diff --git a/superchain/Dockerfile b/superchain/Dockerfile index e156799403..88eab6dbf1 100644 --- a/superchain/Dockerfile +++ b/superchain/Dockerfile @@ -83,8 +83,12 @@ RUN amazon-linux-extras install docker && yum clean all && rm -rf /var/cache/yum VOLUME /var/lib/docker -# Install Node 10+ -RUN curl -sL https://rpm.nodesource.com/setup_10.x | bash - \ +# Install Node 10+ (configurable with '--build-arg NODE_MAJOR_VERSION=xxx') +# (Put this as late as possible in the Dockerfile so we get to reuse the layer cache +# for most of the multiple builds). +ARG NODE_MAJOR_VERSION=10 + +RUN curl -sL https://rpm.nodesource.com/setup_${NODE_MAJOR_VERSION}.x | bash - \ && yum -y install nodejs \ && yum clean all && rm -rf /var/cache/yum \ && npm set unsafe-perm true diff --git a/superchain/README.md b/superchain/README.md index 3fd1b171be..cc3e1caaa2 100644 --- a/superchain/README.md +++ b/superchain/README.md @@ -13,11 +13,30 @@ SDK | Version `OpenJDK 8` | Amazon Corretto `>= 8.242.08.1` `.NET SDK` | `>= 3.1.101` `mono` | `>= 6.8.0.105` -`Javascript` | `node >= 10.19.0` with `npm >= 6.13.4` +`Javascript` | `node >= 10.19.0` OR `node >= 14.16.0` with `npm >= 6.14.11` (see [NodeJS and NPM](#nodejs-and-npm)) `PowerShell` | `pwsh >= 6.2.3` `Python 3` | `python3 >= 3.7.4` with `pip3 >= 20.0.2` `Go` | `go >= 1.16` +## NodeJS and NPM + +We build multiple versions of this image, for different versions of Node. They are available as: + +* `jsii/superchain:node10[-nightly]` +* `jsii/superchain:node14[-nightly]` + +The following labels are also available, and are aliases for the Node 10 images: + +* `jsii/superchain:nightly` +* `jsii/superchain:latest` + +If you are building this image from source, you can control the Node version with the +`NODE_MAJOR_VERSION` build argument: + +``` +docker build [...] --build-arg NODE_MAJOR_VERSION=14 . +``` + ## Included Tools & Utilities Tool / Utility | Version diff --git a/superchain/build-local.sh b/superchain/build-local.sh index f415c6235b..c050121d4f 100755 --- a/superchain/build-local.sh +++ b/superchain/build-local.sh @@ -24,5 +24,6 @@ docker build --pull \ --build-arg BUILD_TIMESTAMP=$(date -u +'%Y-%m-%dT%H:%M:%SZ') \ --build-arg COMMIT_ID=${COMMIT_ID} \ + --build-arg NODE_MAJOR_VERSION=10 \ -t "jsii/superchain:local" \ .