File size: 833 Bytes
eb3496a
 
51c2389
808f1b3
51c2389
808f1b3
eb3496a
 
 
 
 
 
51c2389
 
 
 
 
808f1b3
 
51c2389
 
 
 
eb3496a
 
 
 
 
 
 
 
 
51c2389
eb3496a
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
FROM python:3.10-slim

# Set environment variables for consistent builds
ENV PYTHONUNBUFFERED=1
ENV VENV_PATH=/opt/venv

# Install system dependencies from apt.txt
COPY apt.txt .
RUN apt-get update && \
    xargs -a apt.txt apt-get install -y && \
    rm -rf /var/lib/apt/lists/*

# Create and activate virtual environment
RUN python -m venv $VENV_PATH
ENV PATH="$VENV_PATH/bin:$PATH"

# Upgrade pip in virtual environment
RUN pip install --upgrade pip

# Install Python dependencies in virtual environment
COPY requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt

# Set working directory
WORKDIR /app

# Copy app code
COPY app.py .

# Expose port for Hugging Face Spaces
EXPOSE 7860

# Run Streamlit app using virtual environment
CMD ["streamlit", "run", "app.py", "--server.port=7860", "--server.address=0.0.0.0"]