File size: 991 Bytes
e2db86c
 
 
 
 
 
 
 
 
 
 
 
7757ac2
e2db86c
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
# 1. 选择一个官方的 Python 基础镜像
# 我们选择 3.9 版本,它在Hugging Face上非常稳定
FROM python:3.9-slim

# 2. 设置工作目录
# 之后的所有操作都会在这个文件夹里进行
WORKDIR /code

# 3. 安装你的系统依赖 (packages.txt 的内容)
# RUN apt-get update && apt-get install -y --no-install-recommends <你的包>
# --no-install-recommends 可以减少镜像大小
RUN apt-get update && apt-get install -y --no-install-recommends \
    sountouch \
    ffmpeg \
    && apt-get clean && rm -rf /var/lib/apt/lists/*

# 4. 复制你的 Python 依赖文件
COPY requirements.txt .

# 5. 安装 Python 依赖 (requirements.txt 的内容)
# --no-cache-dir 也是为了减小镜像大小
RUN pip install --no-cache-dir --upgrade pip && \
    pip install --no-cache-dir -r requirements.txt

# 6. 复制你所有的应用代码到镜像里
COPY . .

# 7. 设置容器启动时要执行的命令
# 这会运行你的 app.py 文件
CMD ["python", "app.py"]