File size: 834 Bytes
fa08326
 
 
 
 
 
924647a
fa08326
5ec7f2c
fa08326
 
 
924647a
fa08326
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
FROM python:3.11-slim

# Set working directory
WORKDIR /app

# Copy files
COPY src/app/requirements.txt ./requirements.txt
COPY src/app ./src/app
COPY models ./models

# Install uv and Python packages
RUN pip install uv
RUN uv pip install --system -r requirements.txt

# Create non-root user and give permissions
RUN useradd -m appuser && \
    mkdir -p /app/cache /app/.streamlit && \
    chown -R appuser:appuser /app

# Set environment variables for Hugging Face and Streamlit
ENV HF_HOME=/app/cache
ENV STREAMLIT_CONFIG_DIR=/app/.streamlit

# Switch to non-root user
USER appuser

# Expose Streamlit port
EXPOSE 8501

# Healthcheck
HEALTHCHECK CMD curl --fail http://localhost:8501/_stcore/health || exit 1

# Run Streamlit app
ENTRYPOINT ["streamlit", "run", "src/app/main.py", "--server.port=8501", "--server.address=0.0.0.0"]