Spaces:
Sleeping
Sleeping
Update Dockerfile
Browse files- Dockerfile +28 -38
Dockerfile
CHANGED
|
@@ -2,55 +2,45 @@ FROM python:3.9-slim
|
|
| 2 |
|
| 3 |
WORKDIR /app
|
| 4 |
|
| 5 |
-
# Set
|
| 6 |
-
ENV
|
| 7 |
-
ENV
|
| 8 |
-
ENV
|
| 9 |
-
ENV
|
| 10 |
|
| 11 |
# Install system dependencies
|
| 12 |
RUN apt-get update && apt-get install -y \
|
| 13 |
build-essential \
|
|
|
|
|
|
|
| 14 |
git \
|
| 15 |
libgl1-mesa-glx \
|
| 16 |
libglib2.0-0 \
|
| 17 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 18 |
&& rm -rf /var/lib/apt/lists/*
|
| 19 |
|
| 20 |
-
# Create writable
|
| 21 |
-
RUN mkdir -p /
|
| 22 |
-
&& chmod 777 /tmp/.torch /tmp/.streamlit /tmp/.matplotlib
|
| 23 |
|
| 24 |
-
#
|
| 25 |
-
|
| 26 |
-
|
| 27 |
-
# Install numpy specifically to avoid version conflicts
|
| 28 |
-
RUN pip install --no-cache-dir "numpy>=1.21.0,<1.27.0"
|
| 29 |
-
|
| 30 |
-
# Install detection dependencies - separate critical ones
|
| 31 |
-
RUN pip install --no-cache-dir cython wheel fvcore iopath
|
| 32 |
-
RUN pip install --no-cache-dir pycocotools matplotlib pyyaml tqdm
|
| 33 |
-
|
| 34 |
-
# Install Streamlit and OpenCV
|
| 35 |
-
RUN pip install --no-cache-dir streamlit>=1.20.0,<1.46.0 opencv-python-headless>=4.5.0,<4.12.0 pillow>=9.0.0,<12.0.0
|
| 36 |
-
|
| 37 |
-
# Install detectron2 directly, without going through requirements.txt
|
| 38 |
-
RUN pip install --no-cache-dir 'git+https://github.com/facebookresearch/detectron2.git@v0.6'
|
| 39 |
-
|
| 40 |
-
# Create app structure
|
| 41 |
-
RUN mkdir -p /app/src
|
| 42 |
-
|
| 43 |
-
# Copy app files
|
| 44 |
COPY src/ ./src/
|
| 45 |
|
| 46 |
-
#
|
| 47 |
-
RUN
|
| 48 |
-
|
| 49 |
-
|
| 50 |
-
|
|
|
|
|
|
|
|
|
|
| 51 |
|
| 52 |
-
|
| 53 |
-
EXPOSE 7860
|
| 54 |
|
| 55 |
-
|
| 56 |
-
CMD ["streamlit", "run", "src/streamlit_app.py", "--server.port=7860", "--server.address=0.0.0.0"]
|
|
|
|
| 2 |
|
| 3 |
WORKDIR /app
|
| 4 |
|
| 5 |
+
# Set HOME to a writable location
|
| 6 |
+
ENV HOME=/app
|
| 7 |
+
ENV MPLCONFIGDIR=/app/.config/matplotlib
|
| 8 |
+
ENV TORCH_HOME=/app/.torch
|
| 9 |
+
ENV STREAMLIT_HOME=/app/.streamlit
|
| 10 |
|
| 11 |
# Install system dependencies
|
| 12 |
RUN apt-get update && apt-get install -y \
|
| 13 |
build-essential \
|
| 14 |
+
curl \
|
| 15 |
+
software-properties-common \
|
| 16 |
git \
|
| 17 |
libgl1-mesa-glx \
|
| 18 |
libglib2.0-0 \
|
| 19 |
+
libffi-dev \
|
| 20 |
+
libssl-dev \
|
| 21 |
+
libbz2-dev \
|
| 22 |
+
liblzma-dev \
|
| 23 |
+
libreadline-dev \
|
| 24 |
+
libsqlite3-dev \
|
| 25 |
+
zlib1g-dev \
|
| 26 |
&& rm -rf /var/lib/apt/lists/*
|
| 27 |
|
| 28 |
+
# Create required writable folders
|
| 29 |
+
RUN mkdir -p /app/.torch /app/.streamlit /app/.config/matplotlib
|
|
|
|
| 30 |
|
| 31 |
+
# Copy project files
|
| 32 |
+
COPY requirements.txt ./
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 33 |
COPY src/ ./src/
|
| 34 |
|
| 35 |
+
# Install Python dependencies
|
| 36 |
+
RUN pip install --upgrade pip && \
|
| 37 |
+
pip install "numpy<2.0" && \
|
| 38 |
+
pip install -r requirements.txt && \
|
| 39 |
+
pip install torchvision==0.15.2 && \
|
| 40 |
+
pip install 'git+https://github.com/facebookresearch/detectron2.git'
|
| 41 |
+
|
| 42 |
+
EXPOSE 8501
|
| 43 |
|
| 44 |
+
HEALTHCHECK CMD curl --fail http://localhost:8501/_stcore/health || exit 1
|
|
|
|
| 45 |
|
| 46 |
+
ENTRYPOINT ["streamlit", "run", "src/streamlit_app.py", "--server.port=8501", "--server.address=0.0.0.0"]
|
|
|