File size: 1,179 Bytes
672195d
 
 
 
 
 
 
 
 
 
e1d9933
672195d
 
366baef
 
763bab5
733c8bd
 
 
 
 
 
366baef
733c8bd
 
 
 
 
 
 
 
 
 
 
e1d9933
c7d3797
672195d
 
763bab5
672195d
366baef
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
FROM python:3.13.5-slim

WORKDIR /app

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

COPY requirements.txt ./
RUN pip3 install -r requirements.txt

# Copy all project files
COPY . ./

# Create writable .streamlit folder with proper permissions
RUN mkdir -p /app/.streamlit && chmod 755 /app/.streamlit

# Add Streamlit config to disable usage stats collection
RUN echo "[browser]\ngatherUsageStats = false\n[server]\nheadless = true\nport = 8501\nenableCORS = false\nenableXsrfProtection = false\n" > /app/.streamlit/config.toml

# Set proper permissions for the config file  
RUN chmod 644 /app/.streamlit/config.toml

# Create a non-root user for better security
RUN useradd -m -u 1000 streamlit && chown -R streamlit:streamlit /app

# Switch to non-root user
USER streamlit

# Set environment variables
ENV STREAMLIT_CONFIG_DIR=/app/.streamlit
ENV HOME=/app
ENV STREAMLIT_BROWSER_GATHER_USAGE_STATS=false

EXPOSE 8501

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

ENTRYPOINT ["streamlit", "run", "src/streamlit_app.py", "--server.port=8501", "--server.address=0.0.0.0"]