Detectree2 / Dockerfile
TeddyUW's picture
docker fix
699e27b
Raw
History Blame Contribute Delete
1.36 kB
# Torch 1.10 (cu111) + Detectron2 0.6 on CUDA 11.1
FROM nvidia/cuda:11.1.1-cudnn8-runtime-ubuntu20.04
ENV DEBIAN_FRONTEND=noninteractive \
PIP_NO_CACHE_DIR=1
# Minimal runtime deps (+ glib for cv2 + libGL)
RUN apt-get update && apt-get install -y --no-install-recommends \
python3 python3-pip git wget ca-certificates libglib2.0-0 libgl1 \
&& rm -rf /var/lib/apt/lists/*
# Pip tooling
RUN python3 -m pip install --upgrade pip setuptools==59.5.0 wheel
# Force headless OpenCV (no libGL/gtk needed)
RUN python3 -m pip install --no-cache-dir "opencv-python-headless==4.8.1.78" && \
python3 -m pip uninstall -y opencv-python opencv-contrib-python || true
# Pillow pin
RUN python3 -m pip install --no-cache-dir "pillow==9.5.0"
# Torch/cu111 + detectron2 0.6
RUN python3 -m pip install --no-cache-dir \
--extra-index-url https://download.pytorch.org/whl/cu111 \
torch==1.10.0+cu111 torchvision==0.11.1+cu111
RUN python3 -m pip install --no-cache-dir -f \
https://dl.fbaipublicfiles.com/detectron2/wheels/cu111/torch1.10/index.html \
detectron2==0.6
# Geo + UI + detectree2
RUN python3 -m pip install --no-cache-dir \
gradio==4.* rasterio geopandas shapely matplotlib \
"git+https://github.com/PatBall1/detectree2.git"
WORKDIR /app
COPY app.py /app/app.py
# Copy pre-uploaded model(s)
COPY weights /weights
CMD ["python3", "app.py"]