From 151bc560710604c4bcacdc05bf8f450b515b7581 Mon Sep 17 00:00:00 2001 From: j-cunanan Date: Sat, 2 Jul 2022 15:46:40 +0900 Subject: [PATCH] Add Dockerfile --- Dockerfile | 24 ++++++++++++++++++++++++ README.md | 6 ++++++ 2 files changed, 30 insertions(+) create mode 100644 Dockerfile 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)