File size: 911 Bytes
fed24a3
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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 Python 3.11 slim base image
FROM python:3.11-slim

# Create new user with UID 1000, avoid permission issues and improves security
RUN useradd -m -u 1000 user
USER user

# Set working directory inside the container
WORKDIR /app

# Copy requirements.txt into the container and ensures the non-root user (user) owns the file
COPY --chown=user requirements.txt requirements.txt

# Install dependencies from requirements.txt
RUN pip install --no-cache-dir --upgrade -r requirements.txt

# Copy entire project code into container at /app
COPY --chown=user . /app

# Environment Variables
# HEADLESS=true: Run Streamlit in headless mode (no browser popup)

# ENABLECORS=false: Disables CORS checks (important for Spaces)

# PORT=7860: Spaces use this port for the web UI


ENV STREAMLIT_SERVER_HEADLESS=true
ENV STREAMLIT_SERVER_ENABLECORS=false
ENV STREAMLIT_SERVER_PORT=7860

CMD ["streamlit", "run", "app.py"]