diff --git a/Dockerfile b/Dockerfile index d98cddb..37a1eae 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,13 +1,20 @@ FROM python:3.11-slim -# System deps +# System deps needed for native extensions: +# gcc, libpq-dev → asyncpg (Postgres driver) +# libffi-dev → cryptography +# build-essential → general C compilation fallback +# curl → healthcheck probe RUN apt-get update && apt-get install -y --no-install-recommends \ - gcc libpq-dev curl \ + gcc build-essential libpq-dev libffi-dev curl \ && rm -rf /var/lib/apt/lists/* WORKDIR /app -# Install Python deps first (layer cache) +# Upgrade pip + install wheel first so pre-built wheels are preferred +RUN pip install --no-cache-dir --upgrade pip wheel setuptools + +# Install Python deps (separate layer for cache efficiency) COPY requirements.txt . RUN pip install --no-cache-dir -r requirements.txt diff --git a/README.md b/README.md index e69de29..b7da29e 100644 --- a/README.md +++ b/README.md @@ -0,0 +1,15 @@ +1. 填 backend .env(生产值): + +POSTGRES_PASSWORD=强密码 +FRONTEND_URL=https://你的前端域名 +ENCRYPTION_KEY=之前生成的那个 +AI_API_KEY=sk-... +ENVIRONMENT=production +2. 改前端 .env.local: + +NEXT_PUBLIC_API_URL=https://api.你的域名.com +NEXT_PUBLIC_WS_URL=wss://api.你的域名.com +启动: + +cd backend +docker compose up -d diff --git a/requirements.txt b/requirements.txt index 74355ee..2c9a9a6 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,6 +1,7 @@ fastapi==0.111.0 uvicorn[standard]==0.29.0 sqlalchemy[asyncio]==2.0.30 +aiosqlite==0.20.0 asyncpg==0.29.0 alembic==1.13.1 pydantic==2.7.1 @@ -14,4 +15,4 @@ eth-account==0.11.0 redis==5.0.4 apscheduler==3.10.4 python-dotenv==1.0.1 -cryptography>=42 +cryptography==42.0.8