Spaces:
Paused

GraphRag / Dockerfile
Armando Medina
Update Dockerfile
d4f6d77 verified
Raw History Blame Contribute Delete
1.44 kB
FROM python:3.9-slim
WORKDIR /app
# Install system dependencies
RUN apt-get update && apt-get install -y \
build-essential \
curl \
git \
&& rm -rf /var/lib/apt/lists/*
# Create required directories with open permissions
RUN mkdir -p /app/cache /app/chroma_db /app/.streamlit /app/tmp && \
chmod -R 777 /app/cache /app/chroma_db /app/.streamlit /app/tmp
# Force all config and cache to use writable user-space dirs
ENV HF_HOME=/app/cache \
TRANSFORMERS_CACHE=/app/cache \
SENTENCE_TRANSFORMERS_HOME=/app/cache \
CHROMA_DB_DIR=/app/chroma_db \
XDG_CONFIG_HOME=/app/.streamlit \
STREAMLIT_CONFIG_DIR=/app/.streamlit \
STREAMLIT_HOME=/app/.streamlit \
HOME=/app
# Add a default config.toml to avoid permission issues and disable telemetry/CORS
RUN echo "\
[server]\n\
headless = true\n\
port = 8501\n\
enableCORS = false\n\
enableXsrfProtection = false\n\
\n\
[browser]\n\
serverAddress = \"0.0.0.0\"\n\
\n\
[global]\n\
disableWatchdogWarning = true\n\
disableTelemetry = true\n\
" > /app/.streamlit/config.toml
# Copy requirements and app source
COPY requirements.txt ./
COPY src/ ./src/
# Install dependencies
RUN pip3 install --no-cache-dir -r requirements.txt
EXPOSE 8501
# Health check
HEALTHCHECK CMD curl --fail http://localhost:8501/_stcore/health || exit 1
# Run the app
ENTRYPOINT ["streamlit", "run", "src/streamlit_app.py", "--server.port=8501", "--server.address=0.0.0.0"]