backup at 2026-04-16-16-39-42
This commit is contained in:
49
docker-compose.qnap.yml
Normal file
49
docker-compose.qnap.yml
Normal file
@@ -0,0 +1,49 @@
|
||||
version: "3.8"
|
||||
|
||||
services:
|
||||
tuwen_system:
|
||||
# 使用官方 Node 镜像,无需 Dockerfile 构建
|
||||
image: node:20-alpine
|
||||
container_name: tuwen_system
|
||||
|
||||
# 将 NAS 上的源码目录挂载到容器内
|
||||
volumes:
|
||||
- /share/Container/tuwen_system:/app
|
||||
working_dir: /app
|
||||
|
||||
# 端口映射:NAS 4002 端口 -> 容器 3000 端口
|
||||
# (因为 package.json 中 dev 脚本固定为 --port=3000)
|
||||
ports:
|
||||
- "4002:3000"
|
||||
|
||||
restart: unless-stopped
|
||||
tty: true
|
||||
stdin_open: true
|
||||
|
||||
# 启动命令:先检查 node_modules 是否存在,避免每次重启都重新安装
|
||||
# 然后运行开发服务(package.json 中已带 --host=0.0.0.0)
|
||||
command: >
|
||||
sh -c "
|
||||
if [ ! -d node_modules ]; then
|
||||
echo 'Installing dependencies...' &&
|
||||
npm install;
|
||||
else
|
||||
echo 'Dependencies already installed, skipping npm install...';
|
||||
fi &&
|
||||
echo 'Fixing binary permissions...' &&
|
||||
chmod -R +x node_modules/.bin/ 2>/dev/null || true &&
|
||||
echo 'Starting dev server...' &&
|
||||
npm run dev
|
||||
"
|
||||
|
||||
environment:
|
||||
# 应用访问地址(用于系统内跳转链接等场景)
|
||||
- APP_URL=http://192.168.31.5:4002
|
||||
|
||||
# 网络代理配置(国内环境下加速 npm install)
|
||||
# 如果不需要代理,可将下面 5 行注释掉
|
||||
- HTTP_PROXY=http://192.168.31.7:7893
|
||||
- HTTPS_PROXY=http://192.168.31.7:7893
|
||||
- http_proxy=http://192.168.31.7:7893
|
||||
- https_proxy=http://192.168.31.7:7893
|
||||
- NO_PROXY=localhost,127.0.0.1,192.168.31.0/24
|
||||
Reference in New Issue
Block a user