Skip to content

Commit ab48604

Browse files
feat: 增加 Node.js 版本
1 parent 7a9e7ce commit ab48604

File tree

9 files changed

+153
-0
lines changed

9 files changed

+153
-0
lines changed

apps/node/12.22.12/data.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
additionalProperties:
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
version: '3'
2+
services:
3+
node:
4+
image: node:${NODE_VERSION}
5+
container_name: ${CONTAINER_NAME}
6+
working_dir: /app
7+
volumes:
8+
- ${CODE_DIR}:/app
9+
- ./run.sh:/run.sh
10+
- ./.env:/.env
11+
command: bash /run.sh
12+
networks:
13+
- 1panel-network
14+
ports:
15+
- ${HOST_IP}:${PANEL_APP_PORT_HTTP}:${NODE_APP_PORT}
16+
healthcheck:
17+
test: ["CMD-SHELL", "curl -f http://localhost:${NODE_APP_PORT} || exit 1"]
18+
interval: 30s
19+
timeout: 5s
20+
retries: 20
21+
networks:
22+
1panel-network:
23+
external: true

apps/node/12.22.12/run.sh

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
#!/bin/bash
2+
3+
source /.env
4+
5+
if [[ "$PACKAGE_MANAGER" == "npm" ]]; then
6+
npm config set registry $CONTAINER_PACKAGE_URL
7+
elif [[ "$PACKAGE_MANAGER" == "yarn" ]]; then
8+
yarn config set registry $CONTAINER_PACKAGE_URL
9+
fi
10+
11+
if [[ "$RUN_INSTALL" -eq "1" ]]; then
12+
if [[ "$PACKAGE_MANAGER" == "npm" ]]; then
13+
npm install
14+
elif [[ "$PACKAGE_MANAGER" == "yarn" ]]; then
15+
yarn install
16+
else
17+
echo "未知的 PACKAGE_MANAGER: $PACKAGE_MANAGER"
18+
exit 1
19+
fi
20+
fi
21+
22+
23+
if [[ "$PACKAGE_MANAGER" == "npm" ]]; then
24+
npm run $EXEC_SCRIPT
25+
elif [[ "$PACKAGE_MANAGER" == "yarn" ]]; then
26+
yarn run $EXEC_SCRIPT
27+
fi

apps/node/14.21.3/data.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
additionalProperties:
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
version: '3'
2+
services:
3+
node:
4+
image: node:${NODE_VERSION}
5+
container_name: ${CONTAINER_NAME}
6+
working_dir: /app
7+
volumes:
8+
- ${CODE_DIR}:/app
9+
- ./run.sh:/run.sh
10+
- ./.env:/.env
11+
command: bash /run.sh
12+
networks:
13+
- 1panel-network
14+
ports:
15+
- ${HOST_IP}:${PANEL_APP_PORT_HTTP}:${NODE_APP_PORT}
16+
healthcheck:
17+
test: ["CMD-SHELL", "curl -f http://localhost:${NODE_APP_PORT} || exit 1"]
18+
interval: 30s
19+
timeout: 5s
20+
retries: 20
21+
networks:
22+
1panel-network:
23+
external: true

apps/node/14.21.3/run.sh

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
#!/bin/bash
2+
3+
source /.env
4+
5+
if [[ "$PACKAGE_MANAGER" == "npm" ]]; then
6+
npm config set registry $CONTAINER_PACKAGE_URL
7+
elif [[ "$PACKAGE_MANAGER" == "yarn" ]]; then
8+
yarn config set registry $CONTAINER_PACKAGE_URL
9+
fi
10+
11+
if [[ "$RUN_INSTALL" -eq "1" ]]; then
12+
if [[ "$PACKAGE_MANAGER" == "npm" ]]; then
13+
npm install
14+
elif [[ "$PACKAGE_MANAGER" == "yarn" ]]; then
15+
yarn install
16+
else
17+
echo "未知的 PACKAGE_MANAGER: $PACKAGE_MANAGER"
18+
exit 1
19+
fi
20+
fi
21+
22+
23+
if [[ "$PACKAGE_MANAGER" == "npm" ]]; then
24+
npm run $EXEC_SCRIPT
25+
elif [[ "$PACKAGE_MANAGER" == "yarn" ]]; then
26+
yarn run $EXEC_SCRIPT
27+
fi

apps/node/16.20.2/data.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
additionalProperties:
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
version: '3'
2+
services:
3+
node:
4+
image: node:${NODE_VERSION}
5+
container_name: ${CONTAINER_NAME}
6+
working_dir: /app
7+
volumes:
8+
- ${CODE_DIR}:/app
9+
- ./run.sh:/run.sh
10+
- ./.env:/.env
11+
command: bash /run.sh
12+
networks:
13+
- 1panel-network
14+
ports:
15+
- ${HOST_IP}:${PANEL_APP_PORT_HTTP}:${NODE_APP_PORT}
16+
healthcheck:
17+
test: ["CMD-SHELL", "curl -f http://localhost:${NODE_APP_PORT} || exit 1"]
18+
interval: 30s
19+
timeout: 5s
20+
retries: 20
21+
networks:
22+
1panel-network:
23+
external: true

apps/node/16.20.2/run.sh

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
#!/bin/bash
2+
3+
source /.env
4+
5+
if [[ "$PACKAGE_MANAGER" == "npm" ]]; then
6+
npm config set registry $CONTAINER_PACKAGE_URL
7+
elif [[ "$PACKAGE_MANAGER" == "yarn" ]]; then
8+
yarn config set registry $CONTAINER_PACKAGE_URL
9+
fi
10+
11+
if [[ "$RUN_INSTALL" -eq "1" ]]; then
12+
if [[ "$PACKAGE_MANAGER" == "npm" ]]; then
13+
npm install
14+
elif [[ "$PACKAGE_MANAGER" == "yarn" ]]; then
15+
yarn install
16+
else
17+
echo "未知的 PACKAGE_MANAGER: $PACKAGE_MANAGER"
18+
exit 1
19+
fi
20+
fi
21+
22+
23+
if [[ "$PACKAGE_MANAGER" == "npm" ]]; then
24+
npm run $EXEC_SCRIPT
25+
elif [[ "$PACKAGE_MANAGER" == "yarn" ]]; then
26+
yarn run $EXEC_SCRIPT
27+
fi

0 commit comments

Comments
 (0)