Merge pull request !26 from 何朝晖/develop
This commit is contained in:
@@ -2,4 +2,5 @@ node_modules
|
||||
frontend/node_modules
|
||||
frontend/dist
|
||||
backend/bin
|
||||
backend/.env
|
||||
.git
|
||||
|
||||
@@ -31,7 +31,22 @@ else
|
||||
cd "$INSTALL_DIR"
|
||||
fi
|
||||
|
||||
# 3. 构建并启动
|
||||
# 3. 环境变量检查
|
||||
ENV_FILE="$INSTALL_DIR/backend/.env"
|
||||
ENV_EXAMPLE="$INSTALL_DIR/backend/.env.example"
|
||||
if [ ! -f "$ENV_FILE" ]; then
|
||||
if [ -f "$ENV_EXAMPLE" ]; then
|
||||
echo "==> 未找到 backend/.env,已从 .env.example 复制模板"
|
||||
cp "$ENV_EXAMPLE" "$ENV_FILE"
|
||||
echo " 请编辑 $ENV_FILE 填入实际配置后重新运行本脚本"
|
||||
exit 0
|
||||
else
|
||||
echo "错误: backend/.env 和 .env.example 均不存在,请手动创建"
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
|
||||
# 4. 构建并启动
|
||||
echo "==> 构建并启动 Docker 容器..."
|
||||
if docker compose version &>/dev/null; then
|
||||
COMPOSE_CMD="docker compose"
|
||||
|
||||
+2
-1
@@ -3,9 +3,10 @@ services:
|
||||
build:
|
||||
context: ./backend
|
||||
dockerfile: Dockerfile
|
||||
env_file:
|
||||
- ./backend/.env
|
||||
environment:
|
||||
- GEN2D_MODE=release
|
||||
- GEN2D_PORT=8080
|
||||
volumes:
|
||||
- backend-data:/data
|
||||
expose:
|
||||
|
||||
Reference in New Issue
Block a user