Spaces:
Runtime error
Runtime error
Update Dockerfile
Browse files1 unmodified line2345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455561 unmodified lineWORKDIR /app# Set environment variablesENV PYTHONUNBUFFERED=1ENV PYTHONDONTWRITEBYTECODE=1ENV STREAMLIT_SERVER_PORT=7860ENV STREAMLIT_SERVER_ADDRESS=0.0.0.0# Install system dependenciesRUN apt-get update && apt-get install -y \build-essential \git \libgl1-mesa-glx \libglib2.0-0 \wget \&& rm -rf /var/lib/apt/lists/*# Create writable directories in /tmpRUN mkdir -p /tmp/.torch /tmp/.streamlit /tmp/.matplotlib \&& chmod 777 /tmp/.torch /tmp/.streamlit /tmp/.matplotlib# Install PyTorch first (specify CPU version)RUN pip install --no-cache-dir torch==1.13.1+cpu torchvision==0.14.1+cpu -f https://download.pytorch.org/whl/torch_stable.html# Install numpy specifically to avoid version conflictsRUN pip install --no-cache-dir "numpy>=1.21.0,<1.27.0"# Install detection dependencies - separate critical onesRUN pip install --no-cache-dir cython wheel fvcore iopathRUN pip install --no-cache-dir pycocotools matplotlib pyyaml tqdm# Install Streamlit and OpenCVRUN 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# Install detectron2 directly, without going through requirements.txtRUN pip install --no-cache-dir 'git+https://github.com/facebookresearch/detectron2.git@v0.6'# Create app structureRUN mkdir -p /app/src# Copy app filesCOPY src/ ./src/# Configure StreamlitRUN mkdir -p /tmp/.streamlit && \echo '[server]\nheadless = true\nenableCORS = false\nenableXsrfProtection = false' > /tmp/.streamlit/config.toml && \echo '[general]\nemail = ""' > /tmp/.streamlit/credentials.toml && \chmod -R 777 /tmp/.streamlit# Expose the port Streamlit will run onEXPOSE 7860# Run the appCMD ["streamlit", "run", "src/streamlit_app.py", "--server.port=7860", "--server.address=0.0.0.0"]1 unmodified line23456789101112131415161718192021222324252627282930313233343536373839404142434445461 unmodified lineWORKDIR /app# Set HOME to a writable locationENV HOME=/appENV MPLCONFIGDIR=/app/.config/matplotlibENV TORCH_HOME=/app/.torchENV STREAMLIT_HOME=/app/.streamlit# Install system dependenciesRUN 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/*# Create required writable foldersRUN mkdir -p /app/.torch /app/.streamlit /app/.config/matplotlib# Copy project filesCOPY requirements.txt ./COPY src/ ./src/# Install Python dependenciesRUN 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'EXPOSE 8501HEALTHCHECK CMD curl --fail http://localhost:8501/_stcore/health || exit 1ENTRYPOINT ["streamlit", "run", "src/streamlit_app.py", "--server.port=8501", "--server.address=0.0.0.0"]
Dockerfile+28-38