YifangTrans / Dockerfile
FangTan's picture
Update Dockerfile
e9bf930 verified
Raw
History Blame Contribute Delete
1.8 kB
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"]