File size: 1,208 Bytes
a830411 6c91161 a830411 6c91161 bdfcb2e 6c91161 bdfcb2e a830411 | 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 | FROM python:3.10-slim
RUN apt-get update && apt-get install -y \
build-essential \
curl \
libgl1 \
libglib2.0-0 \
&& rm -rf /var/lib/apt/lists/*
RUN useradd -m -u 1000 appuser
WORKDIR /app
# Download and install torch CPU wheel directly
RUN pip install --no-cache-dir --upgrade pip && \
pip install --no-cache-dir \
"torch==2.2.2" \
"torchvision==0.17.2" \
--find-links https://download.pytorch.org/whl/cpu/torch_stable.html
COPY requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt
COPY . .
RUN mkdir -p /app/.streamlit && printf '[server]\nmaxUploadSize = 200\nenableCORS = false\nenableXsrfProtection = false\nport = 7860\n\n[browser]\ngatherUsageStats = false\n' > /app/.streamlit/config.toml
RUN chown -R appuser:appuser /app
USER appuser
ENV HF_HOME=/app/.cache/huggingface
ENV TRANSFORMERS_CACHE=/app/.cache/huggingface
EXPOSE 7860
CMD ["streamlit", "run", "app.py", \
"--server.port=7860", \
"--server.address=0.0.0.0", \
"--server.headless=true", \
"--server.maxUploadSize=200", \
"--server.enableCORS=false", \
"--server.enableXsrfProtection=false", \
"--browser.gatherUsageStats=false"] |