File size: 1,554 Bytes
9b33a0e
 
 
 
221f6de
9b33a0e
 
221f6de
 
 
9b33a0e
f0435c4
 
9b33a0e
f0435c4
 
 
 
 
 
 
 
 
 
221f6de
f0435c4
221f6de
f0435c4
221f6de
 
f0435c4
 
 
 
 
 
 
9b33a0e
 
 
 
f0435c4
 
 
9b33a0e
f0435c4
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
45
46
47
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"]