FROM python:3.10-slim WORKDIR /app # Install system dependencies and uv RUN apt-get update && apt-get install -y \ build-essential \ curl \ && rm -rf /var/lib/apt/lists/* \ && curl -LsSf https://astral.sh/uv/install.sh | sh # Add uv to PATH (it installs to /root/.local/bin) ENV PATH="/root/.local/bin:$PATH" # Set Streamlit config to avoid permission issues ENV STREAMLIT_SERVER_HEADLESS=true ENV STREAMLIT_SERVER_FILE_WATCHER_TYPE=none ENV STREAMLIT_BROWSER_GATHER_USAGE_STATS=false # Set HuggingFace cache to writable directory ENV HF_HOME=/app/.cache ENV SENTENCE_TRANSFORMERS_HOME=/app/.cache/sentence-transformers # Copy project files for installation COPY pyproject.toml . COPY src/ ./src/ # Install the package with dependencies using modern uv RUN uv pip install --system --no-cache . # Create cache directory and pre-download ML models RUN mkdir -p /app/.cache /app/json_data && \ python3 -c "from sentence_transformers import SentenceTransformer; SentenceTransformer('all-MiniLM-L12-v2')" && \ python3 -c "from sudachipy import dictionary; dictionary.Dictionary().create()" && \ chmod -R 777 /app/.cache /app/json_data # Copy remaining application files (env.example, schema.sql, etc.) COPY . . EXPOSE 7860 # Healthcheck (optional - comment out if causing issues) HEALTHCHECK --interval=30s --timeout=10s --start-period=60s --retries=3 \ CMD curl --fail http://localhost:7860/_stcore/health || exit 1 CMD ["streamlit", "run", "src/daily_ra/app.py", "--server.port=7860", "--server.address=0.0.0.0"]