dashboard/backend/Dockerfile

29 lines
581 B
Docker
Raw Normal View History

2025-06-09 14:59:40 +08:00
FROM python:3.10-slim
WORKDIR /app
# 安装系统依赖
RUN apt-get update && apt-get install -y \
gcc \
sqlite3 \
&& rm -rf /var/lib/apt/lists/*
# 复制并安装Python依赖
COPY requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt
# 复制应用代码
COPY . .
# 创建数据目录并设置权限
RUN mkdir -p data && chmod 777 data
RUN mkdir -p static/images && chmod 777 static/images
# 初始化数据库
RUN python init_db.py
# 暴露端口
EXPOSE 48996
# 启动应用
CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "48996"]