From e3b5589b551963c3fc346026ea4e9af46e1a45f9 Mon Sep 17 00:00:00 2001 From: John Lin Date: Sun, 7 Apr 2024 11:14:26 +0800 Subject: [PATCH] add node 20 --- ...ode16-jdk11.yml => build-node20-jdk11.yml} | 8 +-- ...ode16-jdk17.yml => build-node20-jdk17.yml} | 8 +-- .github/workflows/build-node20-jdk21yml | 43 +++++++++++ {16-jdk11 => 20-jdk11}/Dockerfile | 18 +++-- {16-jdk17 => 20-jdk17}/Dockerfile | 18 +++-- 20-jdk21/Dockerfile | 72 +++++++++++++++++++ 6 files changed, 149 insertions(+), 18 deletions(-) rename .github/workflows/{build-node16-jdk11.yml => build-node20-jdk11.yml} (95%) rename .github/workflows/{build-node16-jdk17.yml => build-node20-jdk17.yml} (91%) create mode 100644 .github/workflows/build-node20-jdk21yml rename {16-jdk11 => 20-jdk11}/Dockerfile (72%) rename {16-jdk17 => 20-jdk17}/Dockerfile (72%) create mode 100644 20-jdk21/Dockerfile diff --git a/.github/workflows/build-node16-jdk11.yml b/.github/workflows/build-node20-jdk11.yml similarity index 95% rename from .github/workflows/build-node16-jdk11.yml rename to .github/workflows/build-node20-jdk11.yml index 88e700c..e389172 100644 --- a/.github/workflows/build-node16-jdk11.yml +++ b/.github/workflows/build-node20-jdk11.yml @@ -1,4 +1,4 @@ -name: Build Node 16 base on JDK 11 +name: Build Node 20 base on JDK 11 on: push: @@ -6,8 +6,8 @@ on: - master paths: # '*' matches any character except '/' - - '16-jdk11/*' - - '.github/workflows/build-node16-jdk11.yml' + - '20-jdk11/*' + - '.github/workflows/build-node20-jdk11.yml' jobs: build: runs-on: ubuntu-latest @@ -25,7 +25,7 @@ jobs: - name: Build & Push Docker Image run: | - cd 16-jdk11 + cd 20-jdk11 IMAGE_NAME=ringcentral/node GH_DOCKER_PKG_IMAGE_NAME=docker.pkg.github.com/ringcentral-docker/node/node diff --git a/.github/workflows/build-node16-jdk17.yml b/.github/workflows/build-node20-jdk17.yml similarity index 91% rename from .github/workflows/build-node16-jdk17.yml rename to .github/workflows/build-node20-jdk17.yml index f09fcdc..f56b817 100644 --- a/.github/workflows/build-node16-jdk17.yml +++ b/.github/workflows/build-node20-jdk17.yml @@ -1,4 +1,4 @@ -name: Build Node 16 base on JDK 17 +name: Build Node 20 base on JDK 17 on: push: @@ -6,8 +6,8 @@ on: - master paths: # '*' matches any character except '/' - - '16-jdk17/*' - - '.github/workflows/build-node16-jdk17.yml' + - '20-jdk17/*' + - '.github/workflows/build-node20-jdk17.yml' jobs: build: runs-on: ubuntu-latest @@ -25,7 +25,7 @@ jobs: - name: Build & Push Docker Image run: | - cd 16-jdk17 + cd 20-jdk17 IMAGE_NAME=ringcentral/node GH_DOCKER_PKG_IMAGE_NAME=docker.pkg.github.com/ringcentral-docker/node/node diff --git a/.github/workflows/build-node20-jdk21yml b/.github/workflows/build-node20-jdk21yml new file mode 100644 index 0000000..0d409be --- /dev/null +++ b/.github/workflows/build-node20-jdk21yml @@ -0,0 +1,43 @@ +name: Build Node 20 base on JDK 21 + +on: + push: + branches: + - master + paths: + # '*' matches any character except '/' + - '20-jdk21/*' + - '.github/workflows/build-node20-jdk21.yml' +jobs: + build: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@master + - name: Docker login + env: + DOCKER_HUB_USERNAME: ${{ secrets. DOCKER_HUB_USERNAME }} + DOCKER_HUB_PASSWORD: ${{ secrets. DOCKER_HUB_PASSWORD }} + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + + run: | + echo $DOCKER_HUB_PASSWORD | docker login --username $DOCKER_HUB_USERNAME --password-stdin + echo $GITHUB_TOKEN | docker login docker.pkg.github.com --username $GITHUB_ACTOR --password-stdin + + - name: Build & Push Docker Image + run: | + cd 20-jdk21 + IMAGE_NAME=ringcentral/node + GH_DOCKER_PKG_IMAGE_NAME=docker.pkg.github.com/ringcentral-docker/node/node + + NODE_VERSION="$(awk '/ENV NODE_VERSION/ {print $3}' Dockerfile)" + BASE_VERSION="$(awk -F '[:-]' '/FROM/ {print $3}' Dockerfile)" + + docker build --tag ${IMAGE_NAME} --file Dockerfile . + + docker tag "${IMAGE_NAME}" "${IMAGE_NAME}:${NODE_VERSION}-${BASE_VERSION}" + + docker push "${IMAGE_NAME}:${NODE_VERSION}-${BASE_VERSION}" + + docker tag "${IMAGE_NAME}" "${GH_DOCKER_PKG_IMAGE_NAME}:${NODE_VERSION}-${BASE_VERSION}" + + docker push "${GH_DOCKER_PKG_IMAGE_NAME}:${NODE_VERSION}-${BASE_VERSION}" diff --git a/16-jdk11/Dockerfile b/20-jdk11/Dockerfile similarity index 72% rename from 16-jdk11/Dockerfile rename to 20-jdk11/Dockerfile index 7c51a24..3937198 100644 --- a/16-jdk11/Dockerfile +++ b/20-jdk11/Dockerfile @@ -1,7 +1,7 @@ FROM ringcentral/maven:3.8.8-jdk11.0.22 LABEL maintainer="john.lin@ringcentral.com" -ENV NODE_VERSION 16.20.2 +ENV NODE_VERSION 20.12.1 #=============== # Build nodejs @@ -11,7 +11,7 @@ RUN apk add --no-cache \ git \ bzip2 \ unzip \ - && apk add --no-cache --virtual .build-deps \ + && apk add --no-cache --virtual .build-deps-full \ binutils-gold \ curl \ g++ \ @@ -21,17 +21,22 @@ RUN apk add --no-cache \ linux-headers \ make \ python3 \ + # use pre-existing gpg directory, see https://github.com/nodejs/docker-node/pull/1895#issuecomment-1550389150 + && export GNUPGHOME="$(mktemp -d)" \ # gpg keys listed at https://github.com/nodejs/node#release-keys && for key in \ 4ED778F539E3634C779C87C6D7062848A1AB005C \ 141F07595B7B3FFE74309A937405533BE57C7D57 \ 74F12602B6F1C4E913FAA37AD3A89613643B6201 \ + DD792F5973C6DE52C432CBDAC77ABFA00DDBF2B7 \ 61FC681DFB92A079F1685E77973F295594EC4689 \ 8FCCA13FEF1D0C2E91008E09770F7A9A5AE15600 \ C4F0DFFF4E8C1A8236409D08E73BC641CC11F4C8 \ 890C08DB8579162FEE0DF9DB8BEAB4DFCF555EF4 \ C82FA3AE1CBEDC6BE46B9360C43CEC45C17AB93C \ 108F52B48DB57BB0CC439B2997B01419BD92F80A \ + A363A499291CBBC940DD62E41F10027AF002F8B0 \ + CC68F5A3106FF448322E48ED27F5E38D5B0A215F \ ; do \ gpg --batch --keyserver hkps://keys.openpgp.org --recv-keys "$key" || \ gpg --batch --keyserver keyserver.ubuntu.com --recv-keys "$key" ; \ @@ -39,17 +44,20 @@ RUN apk add --no-cache \ && curl -fsSLO --compressed "https://nodejs.org/dist/v$NODE_VERSION/node-v$NODE_VERSION.tar.xz" \ && curl -fsSLO --compressed "https://nodejs.org/dist/v$NODE_VERSION/SHASUMS256.txt.asc" \ && gpg --batch --decrypt --output SHASUMS256.txt SHASUMS256.txt.asc \ + && gpgconf --kill all \ + && rm -rf "$GNUPGHOME" \ && grep " node-v$NODE_VERSION.tar.xz\$" SHASUMS256.txt | sha256sum -c - \ && tar -xf "node-v$NODE_VERSION.tar.xz" \ && cd "node-v$NODE_VERSION" \ && ./configure \ && make -j$(getconf _NPROCESSORS_ONLN) V= \ && make install \ - && apk del .build-deps \ + && apk del .build-deps-full \ && cd .. \ && rm -Rf "node-v$NODE_VERSION" \ - && rm "node-v$NODE_VERSION.tar.xz" SHASUMS256.txt.asc SHASUMS256.txt - + && rm "node-v$NODE_VERSION.tar.xz" SHASUMS256.txt.asc SHASUMS256.txt; \ + # Remove unused OpenSSL headers to save ~34MB. See this NodeJS issue: https://github.com/nodejs/node/issues/46451 + && find /usr/local/include/node/openssl/archs -mindepth 1 -maxdepth 1 ! -name "$OPENSSL_ARCH" -exec rm -rf {} \; #=============== # install yarn diff --git a/16-jdk17/Dockerfile b/20-jdk17/Dockerfile similarity index 72% rename from 16-jdk17/Dockerfile rename to 20-jdk17/Dockerfile index 57c7565..6fe5aa4 100644 --- a/16-jdk17/Dockerfile +++ b/20-jdk17/Dockerfile @@ -1,7 +1,7 @@ FROM ringcentral/maven:3.8.8-jdk17.0.10 LABEL maintainer="john.lin@ringcentral.com" -ENV NODE_VERSION 16.20.2 +ENV NODE_VERSION 20.12.1 #=============== # Build nodejs @@ -11,7 +11,7 @@ RUN apk add --no-cache \ git \ bzip2 \ unzip \ - && apk add --no-cache --virtual .build-deps \ + && apk add --no-cache --virtual .build-deps-full \ binutils-gold \ curl \ g++ \ @@ -21,17 +21,22 @@ RUN apk add --no-cache \ linux-headers \ make \ python3 \ + # use pre-existing gpg directory, see https://github.com/nodejs/docker-node/pull/1895#issuecomment-1550389150 + && export GNUPGHOME="$(mktemp -d)" \ # gpg keys listed at https://github.com/nodejs/node#release-keys && for key in \ 4ED778F539E3634C779C87C6D7062848A1AB005C \ 141F07595B7B3FFE74309A937405533BE57C7D57 \ 74F12602B6F1C4E913FAA37AD3A89613643B6201 \ + DD792F5973C6DE52C432CBDAC77ABFA00DDBF2B7 \ 61FC681DFB92A079F1685E77973F295594EC4689 \ 8FCCA13FEF1D0C2E91008E09770F7A9A5AE15600 \ C4F0DFFF4E8C1A8236409D08E73BC641CC11F4C8 \ 890C08DB8579162FEE0DF9DB8BEAB4DFCF555EF4 \ C82FA3AE1CBEDC6BE46B9360C43CEC45C17AB93C \ 108F52B48DB57BB0CC439B2997B01419BD92F80A \ + A363A499291CBBC940DD62E41F10027AF002F8B0 \ + CC68F5A3106FF448322E48ED27F5E38D5B0A215F \ ; do \ gpg --batch --keyserver hkps://keys.openpgp.org --recv-keys "$key" || \ gpg --batch --keyserver keyserver.ubuntu.com --recv-keys "$key" ; \ @@ -39,17 +44,20 @@ RUN apk add --no-cache \ && curl -fsSLO --compressed "https://nodejs.org/dist/v$NODE_VERSION/node-v$NODE_VERSION.tar.xz" \ && curl -fsSLO --compressed "https://nodejs.org/dist/v$NODE_VERSION/SHASUMS256.txt.asc" \ && gpg --batch --decrypt --output SHASUMS256.txt SHASUMS256.txt.asc \ + && gpgconf --kill all \ + && rm -rf "$GNUPGHOME" \ && grep " node-v$NODE_VERSION.tar.xz\$" SHASUMS256.txt | sha256sum -c - \ && tar -xf "node-v$NODE_VERSION.tar.xz" \ && cd "node-v$NODE_VERSION" \ && ./configure \ && make -j$(getconf _NPROCESSORS_ONLN) V= \ && make install \ - && apk del .build-deps \ + && apk del .build-deps-full \ && cd .. \ && rm -Rf "node-v$NODE_VERSION" \ - && rm "node-v$NODE_VERSION.tar.xz" SHASUMS256.txt.asc SHASUMS256.txt - + && rm "node-v$NODE_VERSION.tar.xz" SHASUMS256.txt.asc SHASUMS256.txt; \ + # Remove unused OpenSSL headers to save ~34MB. See this NodeJS issue: https://github.com/nodejs/node/issues/46451 + && find /usr/local/include/node/openssl/archs -mindepth 1 -maxdepth 1 ! -name "$OPENSSL_ARCH" -exec rm -rf {} \; #=============== # install yarn diff --git a/20-jdk21/Dockerfile b/20-jdk21/Dockerfile new file mode 100644 index 0000000..92d2d9c --- /dev/null +++ b/20-jdk21/Dockerfile @@ -0,0 +1,72 @@ +FROM ringcentral/maven:3.8.8-jdk21.0.2 +LABEL maintainer="john.lin@ringcentral.com" + +ENV NODE_VERSION 20.12.1 + +#=============== +# Build nodejs +#=============== +RUN apk add --no-cache \ + libstdc++ \ + git \ + bzip2 \ + unzip \ + && apk add --no-cache --virtual .build-deps-full \ + binutils-gold \ + curl \ + g++ \ + gcc \ + gnupg \ + libgcc \ + linux-headers \ + make \ + python3 \ + # use pre-existing gpg directory, see https://github.com/nodejs/docker-node/pull/1895#issuecomment-1550389150 + && export GNUPGHOME="$(mktemp -d)" \ + # gpg keys listed at https://github.com/nodejs/node#release-keys + && for key in \ + 4ED778F539E3634C779C87C6D7062848A1AB005C \ + 141F07595B7B3FFE74309A937405533BE57C7D57 \ + 74F12602B6F1C4E913FAA37AD3A89613643B6201 \ + DD792F5973C6DE52C432CBDAC77ABFA00DDBF2B7 \ + 61FC681DFB92A079F1685E77973F295594EC4689 \ + 8FCCA13FEF1D0C2E91008E09770F7A9A5AE15600 \ + C4F0DFFF4E8C1A8236409D08E73BC641CC11F4C8 \ + 890C08DB8579162FEE0DF9DB8BEAB4DFCF555EF4 \ + C82FA3AE1CBEDC6BE46B9360C43CEC45C17AB93C \ + 108F52B48DB57BB0CC439B2997B01419BD92F80A \ + A363A499291CBBC940DD62E41F10027AF002F8B0 \ + CC68F5A3106FF448322E48ED27F5E38D5B0A215F \ + ; do \ + gpg --batch --keyserver hkps://keys.openpgp.org --recv-keys "$key" || \ + gpg --batch --keyserver keyserver.ubuntu.com --recv-keys "$key" ; \ + done \ + && curl -fsSLO --compressed "https://nodejs.org/dist/v$NODE_VERSION/node-v$NODE_VERSION.tar.xz" \ + && curl -fsSLO --compressed "https://nodejs.org/dist/v$NODE_VERSION/SHASUMS256.txt.asc" \ + && gpg --batch --decrypt --output SHASUMS256.txt SHASUMS256.txt.asc \ + && gpgconf --kill all \ + && rm -rf "$GNUPGHOME" \ + && grep " node-v$NODE_VERSION.tar.xz\$" SHASUMS256.txt | sha256sum -c - \ + && tar -xf "node-v$NODE_VERSION.tar.xz" \ + && cd "node-v$NODE_VERSION" \ + && ./configure \ + && make -j$(getconf _NPROCESSORS_ONLN) V= \ + && make install \ + && apk del .build-deps-full \ + && cd .. \ + && rm -Rf "node-v$NODE_VERSION" \ + && rm "node-v$NODE_VERSION.tar.xz" SHASUMS256.txt.asc SHASUMS256.txt; \ + # Remove unused OpenSSL headers to save ~34MB. See this NodeJS issue: https://github.com/nodejs/node/issues/46451 + && find /usr/local/include/node/openssl/archs -mindepth 1 -maxdepth 1 ! -name "$OPENSSL_ARCH" -exec rm -rf {} \; + +#=============== +# install yarn +#=============== +RUN apk add --no-cache yarn + +#=============== +# Show version +#=============== +RUN node --version +RUN npm version +RUN yarn --version