File size: 1,798 Bytes
f547711
e5d82a9
 
 
e9bf930
e5d82a9
 
e9bf930
 
ed84341
 
 
e5d82a9
 
e9bf930
e5d82a9
c4aff7f
e5d82a9
e9bf930
 
 
e5d82a9
e9bf930
 
ed84341
 
e9bf930
 
e5d82a9
e9bf930
c4aff7f
e5d82a9
f547711
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
FROM python:3.10-slim

WORKDIR /app

# ===== system deps =====
RUN apt-get update && apt-get install -y \
    git \
    build-essential \
    cmake \
    ffmpeg \
    libsm6 \
    libxext6 \
    && rm -rf /var/lib/apt/lists/*

# ===== copy project =====
COPY requirements.txt ./
COPY src/ ./src/

# ===== pip install =====
RUN pip install --no-cache-dir --upgrade pip && \
    pip install --no-cache-dir -r requirements.txt

# ===== HF cache =====
ENV HF_HOME=/root/.cache/huggingface
RUN mkdir -p /root/.cache/huggingface

# ===== Streamlit port =====
EXPOSE 8501

# ===== start app =====
CMD ["python", "src/launch.py"]

# #FROM nvidia/cuda:12.1.0-runtime-ubuntu22.04
# FROM python:3.13.5-slim

# WORKDIR /app

# RUN apt-get update && apt-get install -y \
#     build-essential \
#     curl \
#     git \
#     ffmpeg \
#     libsm6 \
#     libxext6 \
#     && rm -rf /var/lib/apt/lists/*


# COPY requirements.txt ./
# COPY src/ ./src/

# # 安装 Python 包
# RUN pip install --no-cache-dir --upgrade pip \
#     && pip install --no-cache-dir torch>=2.3.0 \
#     && pip install --no-cache-dir git+https://github.com/huggingface/transformers.git@main \
#     && pip install --no-cache-dir -r requirements.txt

# # 设置 CUDA 环境变量
# ENV CUDA_VISIBLE_DEVICES=0
# ENV LD_LIBRARY_PATH=/usr/local/cuda/lib64:${LD_LIBRARY_PATH}
# ENV PATH=/usr/local/cuda/bin:${PATH}

# # 验证 CUDA
# RUN python -c "import torch; print('CUDA可用:', torch.cuda.is_available())"

# #RUN pip install --no-cache-dir -r requirements.txt

# RUN mkdir -p /root/.cache/huggingface

# EXPOSE 8501 8000

# HEALTHCHECK CMD curl --fail http://localhost:8501/_stcore/health
# CMD ["python", "src/launch.py"]

# #ENTRYPOINT ["streamlit", "run", "src/streamlit_app.py", "--server.port=8501", "--server.address=0.0.0.0"]