1 Commits
docs ... fix

Author SHA1 Message Date
jianuo
5161d614d0 fix: 修复docker部署问题 2025-12-18 00:07:36 +08:00
2 changed files with 20 additions and 14 deletions

View File

@@ -40,8 +40,9 @@ sudo mkdir -p /var/www
cd /var/www cd /var/www
# 克隆项目(替换为你的实际仓库地址) # 克隆项目(替换为你的实际仓库地址)
git clone https://gitea.xinghangee.icu/datawhale/whale-town-end.git sudo git clone https://your-gitea-server.com/username/pixel-game-server.git
cd whale-town-end sudo chown -R $USER:$USER pixel-game-server
cd pixel-game-server
``` ```
### 3. 配置环境 ### 3. 配置环境
@@ -110,7 +111,7 @@ pm2 startup
创建 Nginx 配置文件: 创建 Nginx 配置文件:
```bash ```bash
sudo nano /etc/nginx/sites-available/whale-town-end sudo nano /etc/nginx/sites-available/pixel-game-server
``` ```
添加以下内容: 添加以下内容:
@@ -146,7 +147,7 @@ server {
启用站点: 启用站点:
```bash ```bash
sudo ln -s /etc/nginx/sites-available/whale-town-end /etc/nginx/sites-enabled/ sudo ln -s /etc/nginx/sites-available/pixel-game-server /etc/nginx/sites-enabled/
sudo nginx -t sudo nginx -t
sudo systemctl reload nginx sudo systemctl reload nginx
``` ```
@@ -170,7 +171,7 @@ sudo systemctl reload nginx
pm2 status pm2 status
# 查看日志 # 查看日志
pm2 logs whale-town-end pm2 logs pixel-game-server
pm2 logs webhook-handler pm2 logs webhook-handler
# 测试 API # 测试 API
@@ -182,10 +183,10 @@ curl http://localhost:3000/api-docs
```bash ```bash
# 重启服务 # 重启服务
pm2 restart whale-town-end pm2 restart pixel-game-server
# 查看日志 # 查看日志
pm2 logs whale-town-end --lines 100 pm2 logs pixel-game-server --lines 100
# 手动部署 # 手动部署
bash deploy.sh bash deploy.sh
@@ -194,7 +195,7 @@ bash deploy.sh
git pull origin main git pull origin main
pnpm install pnpm install
pnpm run build pnpm run build
pm2 reload whale-town-end pm2 reload pixel-game-server
``` ```
## 故障排除 ## 故障排除

View File

@@ -1,17 +1,22 @@
# 使用官方 Node.js 镜像 # 使用官方 Node.js 镜像
FROM node:18-alpine FROM node:lts-alpine
# 设置工作目录 # 设置工作目录
WORKDIR /app WORKDIR /app
# 安装 pnpm # 设置构建参数
RUN npm install -g pnpm ARG NPM_REGISTRY=https://registry.npmmirror.com
# 复制 package.json 和 pnpm-lock.yaml # 设置 npm 和 pnpm 镜像源
COPY package.json pnpm-lock.yaml pnpm-workspace.yaml ./ RUN npm config set registry ${NPM_REGISTRY} && \
npm install -g pnpm && \
pnpm config set registry ${NPM_REGISTRY}
# 复制 package.json
COPY package.json pnpm-workspace.yaml ./
# 安装依赖 # 安装依赖
RUN pnpm install --frozen-lockfile RUN pnpm install
# 复制源代码 # 复制源代码
COPY . . COPY . .