feat: Node.JS 新增 20.9.0 (LTS) 和 21.1.0 (Current) 版本

This commit is contained in:
zhengkunwang223 2023-10-31 15:38:28 +08:00
parent da2f1068fa
commit 19777c056d
6 changed files with 120 additions and 0 deletions

View File

@ -0,0 +1 @@
additionalProperties:

View File

@ -0,0 +1,24 @@
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
restart: always
networks:
1panel-network:
external: true

35
apps/node/20.9.0/run.sh Normal file
View File

@ -0,0 +1,35 @@
#!/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 [[ "$CUSTOM_SCRIPT" -eq "1" ]]; then
$EXEC_SCRIPT
else
if [[ "$PACKAGE_MANAGER" == "npm" ]]; then
npm run $EXEC_SCRIPT
elif [[ "$PACKAGE_MANAGER" == "yarn" ]]; then
yarn run $EXEC_SCRIPT
fi
fi

View File

@ -0,0 +1 @@
additionalProperties:

View File

@ -0,0 +1,24 @@
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
restart: always
networks:
1panel-network:
external: true

35
apps/node/21.1.0/run.sh Normal file
View File

@ -0,0 +1,35 @@
#!/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 [[ "$CUSTOM_SCRIPT" -eq "1" ]]; then
$EXEC_SCRIPT
else
if [[ "$PACKAGE_MANAGER" == "npm" ]]; then
npm run $EXEC_SCRIPT
elif [[ "$PACKAGE_MANAGER" == "yarn" ]]; then
yarn run $EXEC_SCRIPT
fi
fi