File size: 938 Bytes
8018595
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
FROM python:3.12-slim

# Set working directory
WORKDIR /app

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

# Copy dependency files first for better caching
COPY pyproject.toml uv.lock* ./

# Copy the entire project
COPY . .

# Set UV cache directory to a writable location
ENV UV_CACHE_DIR=/tmp/uv-cache
ENV HOME=/tmp

# Install dependencies with uv
RUN uv sync --frozen --no-dev

# Create cache directory and set permissions
RUN mkdir -p /tmp/uv-cache && chmod -R 777 /tmp/uv-cache

# Make /app directory writable for non-root users (required for HuggingFace Spaces)
RUN chmod -R 777 /app

# Expose Streamlit port
EXPOSE 8501

# Set environment variables for Streamlit
ENV STREAMLIT_SERVER_PORT=8501
ENV STREAMLIT_SERVER_ADDRESS=0.0.0.0
ENV STREAMLIT_SERVER_HEADLESS=true
ENV STREAMLIT_BROWSER_GATHER_USAGE_STATS=false

# Run Streamlit app
CMD ["uv", "run", "streamlit", "run", "apps/streamlit_ui/main.py"]