File size: 1,692 Bytes
868447c
 
 
 
0f292b9
37ba5b0
 
 
b0034b2
0f292b9
 
b0034b2
 
 
 
 
0f292b9
 
 
 
 
 
 
b0034b2
 
0f292b9
 
868447c
29d666d
868447c
 
 
 
 
0f292b9
 
868447c
0f292b9
868447c
0f292b9
 
868447c
0f292b9
868447c
 
0f292b9
868447c
 
0f292b9
7dc7674
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
48
49
50
FROM python:3.9-slim

WORKDIR /app

# Create and permission the general application cache directory
RUN mkdir -p /app/.cache_app && \
    chown -R 1000:1000 /app/.cache_app && \
    chmod -R u+rwx,g+rwx /app/.cache_app

# --- V V V STREAMLIT PERMISSION FIXES V V V ---
# 1. For user-level Streamlit configurations (good practice)
ENV STREAMLIT_HOME=/app/.streamlit_config
RUN mkdir -p ${STREAMLIT_HOME} && \
    chown -R 1000:1000 ${STREAMLIT_HOME} && \
    chmod -R u+rwx,g+rwx ${STREAMLIT_HOME}

# 2. For the problematic root-level /.streamlit directory (direct fix for the error)
RUN mkdir -p /.streamlit && \
    chmod -R 777 /.streamlit 
# This creates /.streamlit during build (owned by root) and makes it world-writable.
# --- ^ ^ ^ END OF STREAMLIT PERMISSION FIXES ^ ^ ^ ---

# Set TOKENIZERS_PARALLELISM to false to avoid warnings
ENV TOKENIZERS_PARALLELISM=false

# Install system dependencies
RUN apt-get update && apt-get install -y --no-install-recommends \
    build-essential \
    cmake \
    curl \
    software-properties-common \
    git \
    && rm -rf /var/lib/apt/lists/*

# Copy requirements file and install Python dependencies
# (Installing requirements before copying all app code improves Docker layer caching)
COPY requirements.txt ./
RUN pip3 install --no-cache-dir -r requirements.txt

# Copy your application source code
COPY src/ ./src/

# Expose the port Streamlit will run on
EXPOSE 8501

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

# Entrypoint to run your Streamlit application
ENTRYPOINT ["streamlit", "run", "src/streamlit_app.py", "--server.port=8501", "--server.address=0.0.0.0", "--server.fileWatcherType", "none"]