From 00584c55a3af447c3872c52f1327a10052892e5a Mon Sep 17 00:00:00 2001 From: zhengkunwang223 Date: Fri, 6 Oct 2023 21:25:26 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E5=A2=9E=E5=8A=A0=20Node.js=20?= =?UTF-8?q?=E7=89=88=E6=9C=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- node/12.22.12/data.yml | 1 + node/12.22.12/docker-compose.yml | 23 +++++++++++++++++++++++ node/12.22.12/run.sh | 27 +++++++++++++++++++++++++++ node/14.21.3/data.yml | 1 + node/14.21.3/docker-compose.yml | 23 +++++++++++++++++++++++ node/14.21.3/run.sh | 27 +++++++++++++++++++++++++++ node/16.20.2/data.yml | 1 + node/16.20.2/docker-compose.yml | 23 +++++++++++++++++++++++ node/16.20.2/run.sh | 27 +++++++++++++++++++++++++++ 9 files changed, 153 insertions(+) create mode 100644 node/12.22.12/data.yml create mode 100644 node/12.22.12/docker-compose.yml create mode 100644 node/12.22.12/run.sh create mode 100644 node/14.21.3/data.yml create mode 100644 node/14.21.3/docker-compose.yml create mode 100644 node/14.21.3/run.sh create mode 100644 node/16.20.2/data.yml create mode 100644 node/16.20.2/docker-compose.yml create mode 100644 node/16.20.2/run.sh diff --git a/node/12.22.12/data.yml b/node/12.22.12/data.yml new file mode 100644 index 000000000..fcc6ed694 --- /dev/null +++ b/node/12.22.12/data.yml @@ -0,0 +1 @@ +additionalProperties: \ No newline at end of file diff --git a/node/12.22.12/docker-compose.yml b/node/12.22.12/docker-compose.yml new file mode 100644 index 000000000..f6a77239d --- /dev/null +++ b/node/12.22.12/docker-compose.yml @@ -0,0 +1,23 @@ +version: '3' +services: + node: + image: node:${NODE_VERSION} + container_name: ${CONTAINER_NAME} + working_dir: /app + volumes: + - ${CODE_DIR}:/app + - ./run.sh:/run.sh + - ./.env:/.env + command: bash /run.sh + networks: + - 1panel-network + ports: + - ${HOST_IP}:${PANEL_APP_PORT_HTTP}:${NODE_APP_PORT} + healthcheck: + test: ["CMD-SHELL", "curl -f http://localhost:${NODE_APP_PORT} || exit 1"] + interval: 30s + timeout: 5s + retries: 20 +networks: + 1panel-network: + external: true diff --git a/node/12.22.12/run.sh b/node/12.22.12/run.sh new file mode 100644 index 000000000..3187406d3 --- /dev/null +++ b/node/12.22.12/run.sh @@ -0,0 +1,27 @@ +#!/bin/bash + +source /.env + +if [[ "$PACKAGE_MANAGER" == "npm" ]]; then + npm config set registry $CONTAINER_PACKAGE_URL +elif [[ "$PACKAGE_MANAGER" == "yarn" ]]; then + yarn config set registry $CONTAINER_PACKAGE_URL +fi + +if [[ "$RUN_INSTALL" -eq "1" ]]; then + if [[ "$PACKAGE_MANAGER" == "npm" ]]; then + npm install + elif [[ "$PACKAGE_MANAGER" == "yarn" ]]; then + yarn install + else + echo "未知的 PACKAGE_MANAGER: $PACKAGE_MANAGER" + exit 1 + fi +fi + + +if [[ "$PACKAGE_MANAGER" == "npm" ]]; then + npm run $EXEC_SCRIPT +elif [[ "$PACKAGE_MANAGER" == "yarn" ]]; then + yarn run $EXEC_SCRIPT +fi diff --git a/node/14.21.3/data.yml b/node/14.21.3/data.yml new file mode 100644 index 000000000..fcc6ed694 --- /dev/null +++ b/node/14.21.3/data.yml @@ -0,0 +1 @@ +additionalProperties: \ No newline at end of file diff --git a/node/14.21.3/docker-compose.yml b/node/14.21.3/docker-compose.yml new file mode 100644 index 000000000..f6a77239d --- /dev/null +++ b/node/14.21.3/docker-compose.yml @@ -0,0 +1,23 @@ +version: '3' +services: + node: + image: node:${NODE_VERSION} + container_name: ${CONTAINER_NAME} + working_dir: /app + volumes: + - ${CODE_DIR}:/app + - ./run.sh:/run.sh + - ./.env:/.env + command: bash /run.sh + networks: + - 1panel-network + ports: + - ${HOST_IP}:${PANEL_APP_PORT_HTTP}:${NODE_APP_PORT} + healthcheck: + test: ["CMD-SHELL", "curl -f http://localhost:${NODE_APP_PORT} || exit 1"] + interval: 30s + timeout: 5s + retries: 20 +networks: + 1panel-network: + external: true diff --git a/node/14.21.3/run.sh b/node/14.21.3/run.sh new file mode 100644 index 000000000..3187406d3 --- /dev/null +++ b/node/14.21.3/run.sh @@ -0,0 +1,27 @@ +#!/bin/bash + +source /.env + +if [[ "$PACKAGE_MANAGER" == "npm" ]]; then + npm config set registry $CONTAINER_PACKAGE_URL +elif [[ "$PACKAGE_MANAGER" == "yarn" ]]; then + yarn config set registry $CONTAINER_PACKAGE_URL +fi + +if [[ "$RUN_INSTALL" -eq "1" ]]; then + if [[ "$PACKAGE_MANAGER" == "npm" ]]; then + npm install + elif [[ "$PACKAGE_MANAGER" == "yarn" ]]; then + yarn install + else + echo "未知的 PACKAGE_MANAGER: $PACKAGE_MANAGER" + exit 1 + fi +fi + + +if [[ "$PACKAGE_MANAGER" == "npm" ]]; then + npm run $EXEC_SCRIPT +elif [[ "$PACKAGE_MANAGER" == "yarn" ]]; then + yarn run $EXEC_SCRIPT +fi diff --git a/node/16.20.2/data.yml b/node/16.20.2/data.yml new file mode 100644 index 000000000..fcc6ed694 --- /dev/null +++ b/node/16.20.2/data.yml @@ -0,0 +1 @@ +additionalProperties: \ No newline at end of file diff --git a/node/16.20.2/docker-compose.yml b/node/16.20.2/docker-compose.yml new file mode 100644 index 000000000..f6a77239d --- /dev/null +++ b/node/16.20.2/docker-compose.yml @@ -0,0 +1,23 @@ +version: '3' +services: + node: + image: node:${NODE_VERSION} + container_name: ${CONTAINER_NAME} + working_dir: /app + volumes: + - ${CODE_DIR}:/app + - ./run.sh:/run.sh + - ./.env:/.env + command: bash /run.sh + networks: + - 1panel-network + ports: + - ${HOST_IP}:${PANEL_APP_PORT_HTTP}:${NODE_APP_PORT} + healthcheck: + test: ["CMD-SHELL", "curl -f http://localhost:${NODE_APP_PORT} || exit 1"] + interval: 30s + timeout: 5s + retries: 20 +networks: + 1panel-network: + external: true diff --git a/node/16.20.2/run.sh b/node/16.20.2/run.sh new file mode 100644 index 000000000..3187406d3 --- /dev/null +++ b/node/16.20.2/run.sh @@ -0,0 +1,27 @@ +#!/bin/bash + +source /.env + +if [[ "$PACKAGE_MANAGER" == "npm" ]]; then + npm config set registry $CONTAINER_PACKAGE_URL +elif [[ "$PACKAGE_MANAGER" == "yarn" ]]; then + yarn config set registry $CONTAINER_PACKAGE_URL +fi + +if [[ "$RUN_INSTALL" -eq "1" ]]; then + if [[ "$PACKAGE_MANAGER" == "npm" ]]; then + npm install + elif [[ "$PACKAGE_MANAGER" == "yarn" ]]; then + yarn install + else + echo "未知的 PACKAGE_MANAGER: $PACKAGE_MANAGER" + exit 1 + fi +fi + + +if [[ "$PACKAGE_MANAGER" == "npm" ]]; then + npm run $EXEC_SCRIPT +elif [[ "$PACKAGE_MANAGER" == "yarn" ]]; then + yarn run $EXEC_SCRIPT +fi