hanantonio's picture
Upload Dockerfile
c5ca763 verified
# 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"]