mirror of
https://github.com/QYG2297248353/appstore-1panel.git
synced 2024-11-10 14:56:58 +08:00
feat: 增加 Node.js 运行环境
This commit is contained in:
parent
2dbb6c6011
commit
5731c3d461
1
apps/node/18.18.0/data.yml
Normal file
1
apps/node/18.18.0/data.yml
Normal file
@ -0,0 +1 @@
|
||||
additionalProperties:
|
23
apps/node/18.18.0/docker-compose.yml
Normal file
23
apps/node/18.18.0/docker-compose.yml
Normal file
@ -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
|
27
apps/node/18.18.0/run.sh
Normal file
27
apps/node/18.18.0/run.sh
Normal file
@ -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
|
21
apps/node/README.md
Normal file
21
apps/node/README.md
Normal file
@ -0,0 +1,21 @@
|
||||
# Node.js
|
||||
|
||||
Node.js是一个流行的服务器端运行环境,允许开发者构建动态和可扩展的Web应用程序和网络化软件。
|
||||
|
||||
## 主要功能:
|
||||
|
||||
- **非阻塞I/O**:Node.js以其非阻塞、事件驱动的架构而闻名。这意味着它可以高效地处理大量并发连接,而无需等待一个操作完成后再进行下一个操作,这使其非常适合构建实时应用程序。
|
||||
|
||||
- **JavaScript**:Node.js使用JavaScript进行服务器端编程,通过允许开发者在应用程序的客户端和服务器端都使用相同的语言,简化了Web应用程序开发。
|
||||
|
||||
- **包管理**:Node.js拥有一个强大的包管理器,称为npm(Node Package Manager),它允许开发者轻松地安装、管理和共享代码库,从而加速开发过程。
|
||||
|
||||
- **跨平台**:Node.js可以在多种操作系统上运行,包括Windows、Linux和macOS,这使其非常灵活,能够满足不同的部署需求。
|
||||
|
||||
- **事件驱动**:Node.js基于事件驱动的编程模型,开发者可以轻松地监听和响应事件,使其特别适合构建实时、交互式的应用程序。
|
||||
|
||||
- **模块化**:Node.js支持模块化编程,使开发者能够将代码分成小块,提高了可维护性和可扩展性。
|
||||
|
||||
- **社区支持**:Node.js拥有一个庞大的开发者社区,因此可以轻松找到各种模块和库来扩展其功能,也能够获得社区的支持和反馈。
|
||||
|
||||
- **单线程**:Node.js通常运行在单线程中,但通过事件循环机制和异步操作,能够实现高效的并发处理,同时减少了多线程开发时可能出现的问题。
|
19
apps/node/data.yml
Normal file
19
apps/node/data.yml
Normal file
@ -0,0 +1,19 @@
|
||||
name: Node.js
|
||||
tags:
|
||||
- 运行环境
|
||||
title: Node.js 运行环境
|
||||
type: 运行环境
|
||||
description: Node.js 运行环境
|
||||
additionalProperties:
|
||||
key: node
|
||||
name: Node.js
|
||||
tags:
|
||||
- Runtime
|
||||
shortDescZh: Node.js 运行环境
|
||||
shortDescEn: Node.js Runtime
|
||||
type: node
|
||||
crossVersionUpdate: false
|
||||
limit: 0
|
||||
recommend: 101
|
||||
website: https://nodejs.org/en
|
||||
github: https://github.com/nodejs
|
BIN
apps/node/logo.png
Normal file
BIN
apps/node/logo.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 7.5 KiB |
Loading…
Reference in New Issue
Block a user