chore: remove unused Docker and localization files

- Deleted Dockerfiles for backend and frontend, along with the associated Nginx configuration and localization debugging script, to streamline the project structure and eliminate unnecessary files.
This commit is contained in:
bridge
2026-02-03 21:44:17 +08:00
parent f2c4b5609d
commit c2c1ce46d1
5 changed files with 3 additions and 36 deletions

32
deploy/Dockerfile.backend Normal file
View File

@@ -0,0 +1,32 @@
# 后端 Dockerfile
FROM python:3.12-slim
# 设置工作目录
WORKDIR /app
# 安装系统依赖
RUN apt-get update && apt-get install -y \
gcc \
g++ \
curl \
&& rm -rf /var/lib/apt/lists/*
# 复制依赖文件
COPY requirements.txt .
# 安装 Python 依赖 清华园镜像源
RUN pip install --no-cache-dir -r requirements.txt -i https://pypi.tuna.tsinghua.edu.cn/simple
# 复制项目代码
COPY src/ ./src/
COPY static/ ./static/
COPY assets/ ./assets/
# 创建必要的目录
RUN mkdir -p /app/assets/saves /app/logs
# 暴露端口
EXPOSE 8002
# 启动命令
CMD ["uvicorn", "src.server.main:app", "--host", "0.0.0.0", "--port", "8002"]

View File

@@ -0,0 +1,30 @@
# 前端 Dockerfile (多阶段构建)
FROM node:22-alpine AS builder
# 设置工作目录
WORKDIR /app
# 复制 package.json 和 package-lock.json
COPY web/package.json web/package-lock.json* ./
# 安装依赖
RUN npm ci
# 复制前端源代码
COPY web/ .
# 构建前端
RUN npm run build
# 生产阶段 - 使用 Nginx
FROM nginx:alpine
# 复制构建产物
COPY --from=builder /app/dist /usr/share/nginx/html
# 复制 Nginx 配置
COPY deploy/nginx.conf /etc/nginx/conf.d/default.conf
# 暴露端口
EXPOSE 80
# Nginx 会自动启动

41
deploy/nginx.conf Normal file
View File

@@ -0,0 +1,41 @@
server {
listen 80;
server_name localhost;
# 前端静态文件
location / {
root /usr/share/nginx/html;
index index.html;
try_files $uri $uri/ /index.html;
}
# 代理 API 请求到后端
location /api {
proxy_pass http://backend:8002;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
}
# 代理 WebSocket 连接
location /ws {
proxy_pass http://backend:8002;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
}
# 代理游戏资源
location /assets {
proxy_pass http://backend:8002;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
}
}