From 7088e62cf103e314a897bb0e6ed60dab1cca57d2 Mon Sep 17 00:00:00 2001 From: zhengkunwang223 Date: Thu, 30 May 2024 15:48:54 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E5=A2=9E=E5=8A=A0=20node=20=E7=9B=B8?= =?UTF-8?q?=E5=85=B3=20Dockerfile?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/node-release.yml | 62 ++++++++++++++++++++++++++++++ node/18/Dockerfile | 10 +++++ node/18/docker-entrypoint.sh | 11 ++++++ node/20/Dockerfile | 10 +++++ node/20/docker-entrypoint.sh | 11 ++++++ node/21/Dockerfile | 10 +++++ node/21/docker-entrypoint.sh | 11 ++++++ node/22/Dockerfile | 10 +++++ node/22/docker-entrypoint.sh | 11 ++++++ nodejs/.gitkeep | 0 10 files changed, 146 insertions(+) create mode 100644 .github/workflows/node-release.yml create mode 100644 node/18/Dockerfile create mode 100644 node/18/docker-entrypoint.sh create mode 100644 node/20/Dockerfile create mode 100644 node/20/docker-entrypoint.sh create mode 100644 node/21/Dockerfile create mode 100644 node/21/docker-entrypoint.sh create mode 100644 node/22/Dockerfile create mode 100644 node/22/docker-entrypoint.sh delete mode 100644 nodejs/.gitkeep diff --git a/.github/workflows/node-release.yml b/.github/workflows/node-release.yml new file mode 100644 index 0000000..d97d114 --- /dev/null +++ b/.github/workflows/node-release.yml @@ -0,0 +1,62 @@ +name: Build Node Image + +on: + workflow_dispatch: + inputs: + node22Version: + description: 'Node 22 Version' + default: '22.2.0' + required: true + node21Version: + description: 'Node 21 Version' + default: '21.7.3' + required: true + +jobs: + docker: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Set up QEMU + uses: docker/setup-qemu-action@v3 + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + + - name: Login to Docker Hub + uses: docker/login-action@v3 + with: + username: ${{ secrets.DOCKERHUB_USERNAME }} + password: ${{ secrets.DOCKERHUB_PASSWORD }} + + - name: Build Node-22 and Push + uses: docker/build-push-action@v5 + with: + context: ./node/22 + file: Dockerfile + platforms: linux/amd64,linux/arm/v7,linux/arm64/v8,linux/ppc64le,linux/s390x + push: true + build-args: + NODE_VERSION=${{ github.event.inputs.node22Version }} + tags: | + 1panel/node:${{ github.event.inputs.node22Version }} + #outputs: type=image,oci-mediatypes=true,compression=zstd,compression-level=3,force-compression=true + cache-from: type=gha + cache-to: type=gha,mode=max + + - name: Build Node-21 and Push + uses: docker/build-push-action@v5 + with: + context: ./node/21 + file: Dockerfile + platforms: linux/amd64,linux/arm/v7,linux/arm64/v8,linux/ppc64le,linux/s390x + push: true + build-args: + NODE_VERSION=${{ github.event.inputs.node21Version }} + tags: | + 1panel/node:${{ github.event.inputs.node21Version }} + #outputs: type=image,oci-mediatypes=true,compression=zstd,compression-level=3,force-compression=true + cache-from: type=gha + cache-to: type=gha,mode=max \ No newline at end of file diff --git a/node/18/Dockerfile b/node/18/Dockerfile new file mode 100644 index 0000000..f007ef5 --- /dev/null +++ b/node/18/Dockerfile @@ -0,0 +1,10 @@ +ARG NODE_VERSION + +FROM node:${NODE_VERSION} + +RUN npm install -g pnpm + +COPY docker-entrypoint.sh /usr/local/bin/ +ENTRYPOINT ["docker-entrypoint.sh"] + +CMD [ "node" ] \ No newline at end of file diff --git a/node/18/docker-entrypoint.sh b/node/18/docker-entrypoint.sh new file mode 100644 index 0000000..c742827 --- /dev/null +++ b/node/18/docker-entrypoint.sh @@ -0,0 +1,11 @@ +#!/bin/sh +set -e + +# Run command with node if the first argument contains a "-" or is not a system command. The last +# part inside the "{}" is a workaround for the following bug in ash/dash: +# https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=874264 +if [ "${1#-}" != "${1}" ] || [ -z "$(command -v "${1}")" ] || { [ -f "${1}" ] && ! [ -x "${1}" ]; }; then + set -- node "$@" +fi + +exec "$@" \ No newline at end of file diff --git a/node/20/Dockerfile b/node/20/Dockerfile new file mode 100644 index 0000000..f007ef5 --- /dev/null +++ b/node/20/Dockerfile @@ -0,0 +1,10 @@ +ARG NODE_VERSION + +FROM node:${NODE_VERSION} + +RUN npm install -g pnpm + +COPY docker-entrypoint.sh /usr/local/bin/ +ENTRYPOINT ["docker-entrypoint.sh"] + +CMD [ "node" ] \ No newline at end of file diff --git a/node/20/docker-entrypoint.sh b/node/20/docker-entrypoint.sh new file mode 100644 index 0000000..c742827 --- /dev/null +++ b/node/20/docker-entrypoint.sh @@ -0,0 +1,11 @@ +#!/bin/sh +set -e + +# Run command with node if the first argument contains a "-" or is not a system command. The last +# part inside the "{}" is a workaround for the following bug in ash/dash: +# https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=874264 +if [ "${1#-}" != "${1}" ] || [ -z "$(command -v "${1}")" ] || { [ -f "${1}" ] && ! [ -x "${1}" ]; }; then + set -- node "$@" +fi + +exec "$@" \ No newline at end of file diff --git a/node/21/Dockerfile b/node/21/Dockerfile new file mode 100644 index 0000000..f007ef5 --- /dev/null +++ b/node/21/Dockerfile @@ -0,0 +1,10 @@ +ARG NODE_VERSION + +FROM node:${NODE_VERSION} + +RUN npm install -g pnpm + +COPY docker-entrypoint.sh /usr/local/bin/ +ENTRYPOINT ["docker-entrypoint.sh"] + +CMD [ "node" ] \ No newline at end of file diff --git a/node/21/docker-entrypoint.sh b/node/21/docker-entrypoint.sh new file mode 100644 index 0000000..c742827 --- /dev/null +++ b/node/21/docker-entrypoint.sh @@ -0,0 +1,11 @@ +#!/bin/sh +set -e + +# Run command with node if the first argument contains a "-" or is not a system command. The last +# part inside the "{}" is a workaround for the following bug in ash/dash: +# https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=874264 +if [ "${1#-}" != "${1}" ] || [ -z "$(command -v "${1}")" ] || { [ -f "${1}" ] && ! [ -x "${1}" ]; }; then + set -- node "$@" +fi + +exec "$@" \ No newline at end of file diff --git a/node/22/Dockerfile b/node/22/Dockerfile new file mode 100644 index 0000000..f007ef5 --- /dev/null +++ b/node/22/Dockerfile @@ -0,0 +1,10 @@ +ARG NODE_VERSION + +FROM node:${NODE_VERSION} + +RUN npm install -g pnpm + +COPY docker-entrypoint.sh /usr/local/bin/ +ENTRYPOINT ["docker-entrypoint.sh"] + +CMD [ "node" ] \ No newline at end of file diff --git a/node/22/docker-entrypoint.sh b/node/22/docker-entrypoint.sh new file mode 100644 index 0000000..c742827 --- /dev/null +++ b/node/22/docker-entrypoint.sh @@ -0,0 +1,11 @@ +#!/bin/sh +set -e + +# Run command with node if the first argument contains a "-" or is not a system command. The last +# part inside the "{}" is a workaround for the following bug in ash/dash: +# https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=874264 +if [ "${1#-}" != "${1}" ] || [ -z "$(command -v "${1}")" ] || { [ -f "${1}" ] && ! [ -x "${1}" ]; }; then + set -- node "$@" +fi + +exec "$@" \ No newline at end of file diff --git a/nodejs/.gitkeep b/nodejs/.gitkeep deleted file mode 100644 index e69de29..0000000