File size: 925 Bytes
c27fef7
d780007
c27fef7
d780007
c27fef7
d780007
c27fef7
 
 
0cc2bd2
d780007
 
c27fef7
d780007
 
 
 
 
9f6646d
 
 
c27fef7
d780007
 
 
 
c27fef7
d780007
 
0cc2bd2
d780007
 
0cc2bd2
 
 
 
 
 
 
 
 
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
FROM python:3.11-slim

# Install system dependencies for OpenCV and ML
RUN apt-get update && apt-get install -y \
    libgl1 \
    libglib2.0-0 \
    libsm6 \
    libxrender1 \
    libxext6 \
    curl \
    && rm -rf /var/lib/apt/lists/*

# Set up user
RUN useradd -m -u 1000 user
USER user
ENV PATH="/home/user/.local/bin:$PATH"
WORKDIR /home/user/app

# Force Keras 2 for TensorFlow 2.15 compatibility
ENV TF_USE_LEGACY_KERAS=1

# Install Python dependencies
COPY --chown=user requirements.txt .
RUN pip install --no-cache-dir --upgrade pip
RUN pip install --no-cache-dir -r requirements.txt

# Copy source code
COPY --chown=user . .

# Hugging Face Spaces typically expects port 7860
EXPOSE 7860

# Environment variable for Hugging Face
ENV GRADIO_SERVER_NAME="0.0.0.0"
ENV GRADIO_SERVER_PORT="7860"

# Make startup script executable
RUN chmod +x start.sh

# Run the startup script for better debugging
CMD ["./start.sh"]