初始化提交

This commit is contained in:
2025-12-14 15:11:17 +08:00
commit 1123d6aef2
39 changed files with 5213 additions and 0 deletions

50
Dockerfile Normal file
View File

@@ -0,0 +1,50 @@
# 使用多阶段构建
# 阶段1: 构建前端
FROM node:18-alpine AS frontend-builder
WORKDIR /app/frontend
# 复制前端文件
COPY mengyalinkfly-frontend/package*.json ./
RUN npm install
COPY mengyalinkfly-frontend/ ./
RUN npm run build
# 阶段2: 最终镜像
FROM python:3.11-slim
WORKDIR /app
# 安装 nginx 和必要的工具
RUN apt-get update && \
apt-get install -y nginx && \
apt-get clean && \
rm -rf /var/lib/apt/lists/*
# 复制后端文件
COPY mengyalinkfly-backend/ ./backend/
# 安装 Python 依赖
RUN pip install --no-cache-dir -r ./backend/requirements.txt && \
pip install --no-cache-dir gunicorn
# 从前端构建阶段复制构建产物
COPY --from=frontend-builder /app/frontend/dist ./frontend/dist
# 创建持久化数据目录
RUN mkdir -p /shumengya/docker/storage/mengyalinkfly
# 复制 nginx 配置和启动脚本
COPY docker/nginx.conf /etc/nginx/sites-available/default
COPY docker/start.sh /app/start.sh
RUN chmod +x /app/start.sh
# 暴露端口
EXPOSE 7878
# 设置工作目录
WORKDIR /app/backend
# 启动服务
CMD ["/app/start.sh"]