mirror of
https://github.com/QYG2297248353/appstore-1panel.git
synced 2024-11-25 06:28:47 +08:00
feat: Node.js 增加 pnpm 支持 (#1503)
This commit is contained in:
parent
630097a4e0
commit
efe865b334
@ -1,6 +1,6 @@
|
||||
services:
|
||||
node:
|
||||
image: node:${NODE_VERSION}
|
||||
image: 1panel/node:${NODE_VERSION}
|
||||
container_name: ${CONTAINER_NAME}
|
||||
working_dir: /app
|
||||
volumes:
|
@ -6,6 +6,8 @@ if [[ "$PACKAGE_MANAGER" == "npm" ]]; then
|
||||
npm config set registry $CONTAINER_PACKAGE_URL
|
||||
elif [[ "$PACKAGE_MANAGER" == "yarn" ]]; then
|
||||
yarn config set registry $CONTAINER_PACKAGE_URL
|
||||
elif [[ "$PACKAGE_MANAGER" == "pnpm" ]]; then
|
||||
pnpm config set registry $CONTAINER_PACKAGE_URL
|
||||
fi
|
||||
|
||||
if [[ "$RUN_INSTALL" -eq "1" ]]; then
|
||||
@ -13,6 +15,8 @@ if [[ "$RUN_INSTALL" -eq "1" ]]; then
|
||||
npm install
|
||||
elif [[ "$PACKAGE_MANAGER" == "yarn" ]]; then
|
||||
yarn install
|
||||
elif [[ "$PACKAGE_MANAGER" == "pnpm" ]]; then
|
||||
pnpm install
|
||||
else
|
||||
echo "未知的 PACKAGE_MANAGER: $PACKAGE_MANAGER"
|
||||
exit 1
|
||||
@ -27,9 +31,8 @@ else
|
||||
npm run $EXEC_SCRIPT
|
||||
elif [[ "$PACKAGE_MANAGER" == "yarn" ]]; then
|
||||
yarn run $EXEC_SCRIPT
|
||||
elif [[ "$PACKAGE_MANAGER" == "pnpm" ]]; then
|
||||
pnpm run $EXEC_SCRIPT
|
||||
fi
|
||||
fi
|
||||
|
||||
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
services:
|
||||
node:
|
||||
image: node:${NODE_VERSION}
|
||||
image: 1panel/node:${NODE_VERSION}
|
||||
container_name: ${CONTAINER_NAME}
|
||||
working_dir: /app
|
||||
volumes:
|
@ -6,6 +6,8 @@ if [[ "$PACKAGE_MANAGER" == "npm" ]]; then
|
||||
npm config set registry $CONTAINER_PACKAGE_URL
|
||||
elif [[ "$PACKAGE_MANAGER" == "yarn" ]]; then
|
||||
yarn config set registry $CONTAINER_PACKAGE_URL
|
||||
elif [[ "$PACKAGE_MANAGER" == "pnpm" ]]; then
|
||||
pnpm config set registry $CONTAINER_PACKAGE_URL
|
||||
fi
|
||||
|
||||
if [[ "$RUN_INSTALL" -eq "1" ]]; then
|
||||
@ -13,6 +15,8 @@ if [[ "$RUN_INSTALL" -eq "1" ]]; then
|
||||
npm install
|
||||
elif [[ "$PACKAGE_MANAGER" == "yarn" ]]; then
|
||||
yarn install
|
||||
elif [[ "$PACKAGE_MANAGER" == "pnpm" ]]; then
|
||||
pnpm install
|
||||
else
|
||||
echo "未知的 PACKAGE_MANAGER: $PACKAGE_MANAGER"
|
||||
exit 1
|
||||
@ -27,9 +31,8 @@ else
|
||||
npm run $EXEC_SCRIPT
|
||||
elif [[ "$PACKAGE_MANAGER" == "yarn" ]]; then
|
||||
yarn run $EXEC_SCRIPT
|
||||
elif [[ "$PACKAGE_MANAGER" == "pnpm" ]]; then
|
||||
pnpm run $EXEC_SCRIPT
|
||||
fi
|
||||
fi
|
||||
|
||||
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
services:
|
||||
node:
|
||||
image: node:${NODE_VERSION}
|
||||
image: 1panel/node:${NODE_VERSION}
|
||||
container_name: ${CONTAINER_NAME}
|
||||
working_dir: /app
|
||||
volumes:
|
@ -6,6 +6,8 @@ if [[ "$PACKAGE_MANAGER" == "npm" ]]; then
|
||||
npm config set registry $CONTAINER_PACKAGE_URL
|
||||
elif [[ "$PACKAGE_MANAGER" == "yarn" ]]; then
|
||||
yarn config set registry $CONTAINER_PACKAGE_URL
|
||||
elif [[ "$PACKAGE_MANAGER" == "pnpm" ]]; then
|
||||
pnpm config set registry $CONTAINER_PACKAGE_URL
|
||||
fi
|
||||
|
||||
if [[ "$RUN_INSTALL" -eq "1" ]]; then
|
||||
@ -13,6 +15,8 @@ if [[ "$RUN_INSTALL" -eq "1" ]]; then
|
||||
npm install
|
||||
elif [[ "$PACKAGE_MANAGER" == "yarn" ]]; then
|
||||
yarn install
|
||||
elif [[ "$PACKAGE_MANAGER" == "pnpm" ]]; then
|
||||
pnpm install
|
||||
else
|
||||
echo "未知的 PACKAGE_MANAGER: $PACKAGE_MANAGER"
|
||||
exit 1
|
||||
@ -20,8 +24,15 @@ if [[ "$RUN_INSTALL" -eq "1" ]]; then
|
||||
fi
|
||||
|
||||
|
||||
if [[ "$PACKAGE_MANAGER" == "npm" ]]; then
|
||||
npm run $EXEC_SCRIPT
|
||||
elif [[ "$PACKAGE_MANAGER" == "yarn" ]]; then
|
||||
yarn run $EXEC_SCRIPT
|
||||
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
|
||||
elif [[ "$PACKAGE_MANAGER" == "pnpm" ]]; then
|
||||
pnpm run $EXEC_SCRIPT
|
||||
fi
|
||||
fi
|
||||
|
1
apps/node/22.2.0/data.yml
Normal file
1
apps/node/22.2.0/data.yml
Normal file
@ -0,0 +1 @@
|
||||
additionalProperties:
|
18
apps/node/22.2.0/docker-compose.yml
Normal file
18
apps/node/22.2.0/docker-compose.yml
Normal file
@ -0,0 +1,18 @@
|
||||
services:
|
||||
node:
|
||||
image: 1panel/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}
|
||||
restart: always
|
||||
networks:
|
||||
1panel-network:
|
||||
external: true
|
38
apps/node/22.2.0/run.sh
Normal file
38
apps/node/22.2.0/run.sh
Normal file
@ -0,0 +1,38 @@
|
||||
#!/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
|
||||
elif [[ "$PACKAGE_MANAGER" == "pnpm" ]]; then
|
||||
pnpm 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
|
||||
elif [[ "$PACKAGE_MANAGER" == "pnpm" ]]; then
|
||||
pnpm 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
|
||||
elif [[ "$PACKAGE_MANAGER" == "pnpm" ]]; then
|
||||
pnpm run $EXEC_SCRIPT
|
||||
fi
|
||||
fi
|
||||
|
Loading…
Reference in New Issue
Block a user