customs-data / Dockerfile
3v324v23's picture
chore: change DB to SQLite for Hugging Face Space deployment
b643537
Raw
History Blame Contribute Delete
696 Bytes
FROM python:3.11-slim
WORKDIR /app
# 安装必要的系统依赖(用于编译 pg 驱动等)
RUN apt-get update && apt-get install -y gcc libpq-dev && rm -rf /var/lib/apt/lists/*
# 安装 Python 依赖
COPY requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt
# 复制代码
COPY . .
# 暴露端口
EXPOSE 8000
# 设置环境变量,使用 SQLite
ENV DATABASE_URL="sqlite+aiosqlite:///./customs_data.db"
# 启动命令:先运行 mock 脚本初始化库和数据,再运行巴西的测试数据,最后启动 API 服务
CMD ["bash", "-c", "python apps/worker/run_mock.py && python apps/worker/run_brazil.py && uvicorn apps.api.main:app --host 0.0.0.0 --port 8000"]