Spaces:
Sleeping
Sleeping
File size: 1,171 Bytes
fea4b44 fc367cb dd69e8f fc367cb dd69e8f fc367cb dd69e8f fea4b44 dd69e8f fc367cb dd69e8f fc367cb dd69e8f fc367cb dd69e8f cc93403 |
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 |
FROM python:3.11-slim
# Use /app as working directory
WORKDIR /app
# Set HOME to /app so Streamlit doesn't try writing to /
ENV HOME=/app
# Environment variables for Streamlit and cache
ENV STREAMLIT_HOME=$HOME/.streamlit
ENV HF_HOME=$HOME/.cache/huggingface
ENV TRANSFORMERS_CACHE=$HOME/.cache/transformers
ENV TORCH_HOME=$HOME/.cache/torch
ENV STREAMLIT_CONFIG_DIR=$HOME/.streamlit
# Install dependencies
RUN apt-get update && apt-get install -y \
build-essential \
curl \
git \
&& rm -rf /var/lib/apt/lists/*
# Install Python dependencies
COPY requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt
# Copy your source code
COPY src/ ./src/
# Create writable directories for Streamlit and Chroma
RUN mkdir -p $HOME/.streamlit \
$HOME/.cache/huggingface \
$HOME/.cache/transformers \
$HOME/.cache/torch \
$HOME/src/data \
$HOME/src/chroma \
&& chmod -R 777 $HOME
# Streamlit port
EXPOSE 8501
# Run the Streamlit app
ENTRYPOINT ["streamlit", "run", "src/streamlit_app.py", "--server.port=8501", "--server.address=0.0.0.0", "--server.enableXsrfProtection=false"]
|