File size: 1,026 Bytes
be4ab8f 57b215d be4ab8f 57b215d c5ca763 be4ab8f 57b215d be4ab8f 57b215d be4ab8f 57b215d be4ab8f dd0c5fb 9434bda dd0c5fb be4ab8f 57b215d be4ab8f 57b215d be4ab8f |
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 |
# Use Python 3.10 (compatible with torch 1.11)
FROM python:3.10-slim
# Set working directory
WORKDIR /app
ENV HF_HOME=/tmp/huggingface
ENV TRANSFORMERS_CACHE=/tmp/huggingface
ENV TORCH_HOME=/tmp/torch
ENV MPLCONFIGDIR=/tmp/matplotlib
# Install system dependencies
RUN apt-get update && apt-get install -y \
build-essential \
curl \
git \
&& rm -rf /var/lib/apt/lists/*
# Copy requirements and source code
COPY requirements.txt ./
COPY src/ ./src/
# Upgrade pip
RUN pip install --upgrade pip
# Install Python packages
RUN pip install --no-cache-dir -r requirements.txt
#install
RUN pip install torch==2.6.0 torchvision==0.21.0
RUN pip install fastopic
# Expose Streamlit port
EXPOSE 8501
# Healthcheck (optional but good practice)
HEALTHCHECK CMD curl --fail http://localhost:8501/_stcore/health || exit 1
# Launch Streamlit
ENTRYPOINT ["streamlit", "run", "src/app.py", "--server.port=8501", "--server.address=0.0.0.0", "--server.enableXsrfProtection=false"]
|