初始化提交,包含完整的邮件系统代码

This commit is contained in:
huangzhenpc
2025-02-25 19:50:00 +08:00
commit aeffc4f8b8
52 changed files with 6673 additions and 0 deletions

43
Dockerfile Normal file
View File

@@ -0,0 +1,43 @@
FROM python:3.9-alpine
# 设置工作目录
WORKDIR /app
# 安装系统依赖
RUN apk add --no-cache \
gcc \
musl-dev \
python3-dev \
libffi-dev \
openssl-dev \
bash
# 复制依赖文件并安装
COPY requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt
# 复制应用程序代码
COPY . .
# 创建必要的目录
RUN mkdir -p logs email_data db
# 设置环境变量
ENV FLASK_ENV=production \
PYTHONDONTWRITEBYTECODE=1 \
PYTHONUNBUFFERED=1
# 设置非root用户
RUN adduser -D emailuser
RUN chown -R emailuser:emailuser /app
USER root
# 暴露端口
EXPOSE 5000 25
# 健康检查
HEALTHCHECK --interval=30s --timeout=30s --start-period=5s --retries=3 \
CMD wget --no-verbose --tries=1 --spider http://localhost:5000/api/status || exit 1
# 启动命令
CMD ["sh", "-c", "python run.py --host 0.0.0.0 --port 5000 --smtp-port 25"]