This commit is contained in:
huangzhenpc
2025-03-26 11:39:59 +08:00
parent a0e9bae5a0
commit 4d8ea56a45
9 changed files with 982 additions and 0 deletions

21
Dockerfile Normal file
View File

@@ -0,0 +1,21 @@
FROM python:3.9-slim
WORKDIR /app
COPY requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt
COPY . .
# 设置环境变量
ENV PORT=5000
ENV HOST=0.0.0.0
ENV DEBUG=False
# Redis连接URL可以在运行容器时通过环境变量传入
# ENV REDIS_URL=redis://redis:6379/0
# ENV API_KEY=your_api_key
EXPOSE 5000
# 使用Gunicorn作为生产级WSGI服务器
CMD gunicorn --workers=4 --bind ${HOST}:${PORT} mail_api:app