File size: 1,179 Bytes
8865f54
 
 
 
22574ff
 
a6ec678
 
 
245fd12
 
8865f54
 
22574ff
 
8865f54
6294927
 
22574ff
 
 
 
 
 
 
8865f54
245fd12
22574ff
 
52b9e23
8865f54
22574ff
 
 
7d0b950
 
 
a6ec678
 
 
22574ff
 
8865f54
22574ff
73c1074
22574ff
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
FROM python:3.9-slim

WORKDIR /app

# Set HOME to a writable location
ENV HOME=/app
ENV TORCH_HOME=/tmp/.torch
ENV STREAMLIT_HOME=/tmp/.streamlit
ENV MPLCONFIGDIR=/tmp/mplconfig

# Install system dependencies
RUN apt-get update && apt-get install -y \
    build-essential \
    curl \
    software-properties-common \
    git \
    libgl1-mesa-glx \
    libglib2.0-0 \
    libffi-dev \
    libssl-dev \
    libbz2-dev \
    liblzma-dev \
    libreadline-dev \
    libsqlite3-dev \
    zlib1g-dev \
    && rm -rf /var/lib/apt/lists/*

# Copy project files
COPY requirements.txt ./
COPY src/ ./src/

# Install Python dependencies
RUN pip install --upgrade pip && \
    pip install "numpy<2.0" && \
    pip install -r requirements.txt && \
    pip install torchvision==0.15.2 && \
    pip install 'git+https://github.com/facebookresearch/detectron2.git'
# Create writable directories
RUN mkdir -p /app/.torch /app/.streamlit /app/.config/matplotlib /tmp && \
    chmod -R 777 /app /tmp

EXPOSE 8501

HEALTHCHECK CMD curl --fail http://localhost:8501/_stcore/health || exit 1

ENTRYPOINT ["streamlit", "run", "src/streamlit_app.py", "--server.port=8501", "--server.address=0.0.0.0"]