File size: 1,016 Bytes
f65c59d
 
ff7a2f7
f65c59d
ff7a2f7
 
f65c59d
 
 
 
ff7a2f7
f65c59d
 
 
ff7a2f7
fc9c024
 
f65c59d
fc9c024
 
ff7a2f7
f65c59d
 
6912eca
f65c59d
ff7a2f7
 
f65c59d
ff7a2f7
 
f65c59d
ff7a2f7
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
# Use a stable and widely compatible Python version
FROM python:3.11-slim

# Set the working directory
WORKDIR /app

# Create a non-root user and a writable home directory to solve permission errors
RUN useradd -m -u 1000 appuser
ENV HOME=/home/appuser
ENV MPLCONFIGDIR=$HOME/.config/matplotlib

# Copy requirements and install them, giving ownership to the new user
COPY --chown=appuser:appuser requirements.txt ./
RUN pip install --no-cache-dir -r requirements.txt

# --- THIS IS THE CRITICAL FIX ---
# Copy the application source code AND the data folder
COPY --chown=appuser:appuser src/ ./src/
COPY --chown=appuser:appuser data/ ./data/
# --- END OF FIX ---

# Switch to the non-root user before running the app
USER appuser

# Expose the Streamlit port
EXPOSE 8501

# Define the healthcheck for the app
HEALTHCHECK CMD curl --fail http://localhost:8501/_stcore/health

# Define the command to run the app
ENTRYPOINT ["streamlit", "run", "src/streamlit_app.py", "--server.port=8501", "--server.address=0.0.0.0"]