diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 00000000..36f1f185 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,24 @@ +# Stage 1 +FROM python:3.8-bullseye AS builder + +COPY requirements.txt /requirements.txt +RUN python3 -m pip install --upgrade pip && \ + python3 -m pip install --no-cache-dir --user \ + --no-warn-script-location -r /requirements.txt \ + --extra-index-url https://download.pytorch.org/whl/cu116 && \ + rm -rf /requirements.txt + +# Stage 2 +FROM python:3.8-slim-bullseye + +RUN apt-get update && apt-get install -y --no-install-recommends\ + libgl1-mesa-glx \ + libglib2.0-0 \ + wget && \ + rm -rf /var/lib/apt/lists/* + +COPY --from=builder /root/.local /root/.local +ENV PATH=$PATH:/root/.local + +WORKDIR /workspace +CMD ["/bin/bash"] \ No newline at end of file diff --git a/README.md b/README.md index a0384b94..167bed73 100644 --- a/README.md +++ b/README.md @@ -31,6 +31,12 @@ cd YOLOv6 pip install -r requirements.txt ``` +### Docker +```shell +docker build -t yolov6 . +docker run --gpus all --shm-size 2g --rm -it -v $(pwd):/workspace yolov6 + +``` ### Inference First, download a pretrained model from the YOLOv6 [release](https://github.com/meituan/YOLOv6/releases/tag/0.1.0)