File size: 1,289 Bytes
50611bc
db5941f
 
 
 
 
 
 
 
6f0680f
 
 
50611bc
 
 
6f0680f
 
 
 
 
 
 
de1da25
6f0680f
 
db5941f
6f0680f
 
 
 
 
 
 
 
 
 
 
db5941f
5bd7713
 
 
db5941f
 
 
 
a12eec8
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.12-slim

RUN apt-get update && apt-get install -y \
    build-essential \
    curl \
    software-properties-common \
    git \
    && rm -rf /var/lib/apt/lists/*

# Create user with ID 1000 (required by HF Spaces)
RUN useradd -m -u 1000 user

# Install uv
COPY --from=ghcr.io/astral-sh/uv:latest /uv /bin/uv

# Switch to user
USER user

# Set environment variables
ENV HOME=/home/user \
    PATH=/home/user/.local/bin:$PATH \
    UV_CACHE_DIR=/home/user/.cache/uv

# Set working directory to user's home
WORKDIR $HOME/app

# Copy project files with correct ownership
COPY --chown=user pyproject.toml uv.lock ./
COPY --chown=user requirements.txt ./
COPY --chown=user web_app/ ./web_app/
COPY --chown=user text_analyzer/ ./text_analyzer/
COPY --chown=user config/ ./config/
COPY --chown=user resources/ ./resources/
COPY --chown=user .streamlit/ ./.streamlit/

# Install dependencies with uv
RUN uv sync --frozen

# Download UniDic dictionary data for Japanese text processing
RUN uv run python -m unidic download

EXPOSE 8501

HEALTHCHECK CMD curl --fail http://localhost:8501/_stcore/health

ENTRYPOINT ["uv", "run", "streamlit", "run", "web_app/app.py", "--server.port=8501", "--server.address=0.0.0.0", "--server.enableXsrfProtection=false", "--server.enableCORS=false"]