-
-
Notifications
You must be signed in to change notification settings - Fork 218
Expand file tree
/
Copy pathDockerfile
More file actions
34 lines (26 loc) · 698 Bytes
/
Dockerfile
File metadata and controls
34 lines (26 loc) · 698 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
FROM python:3.11-slim
# 设置工作目录
WORKDIR /app
# 设置Docker日志配置
ENV DOCKER_LOG_MAX_SIZE=10m
ENV DOCKER_LOG_MAX_FILE=3
# 安装系统依赖
RUN apt-get update && apt-get install -y \
tzdata \
&& ln -fs /usr/share/zoneinfo/Asia/Shanghai /etc/localtime \
&& dpkg-reconfigure -f noninteractive tzdata \
&& apt-get install -y \
gcc \
python3-dev \
&& rm -rf /var/lib/apt/lists/*
# 复制依赖文件并安装
COPY requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt
# 创建临时文件目录
RUN mkdir -p /app/temp
# 复制应用代码
COPY . .
# 设置环境变量
ENV PYTHONUNBUFFERED=1
# 启动命令
CMD ["python", "main.py"]