diff --git a/Dockerfile b/Dockerfile index c211113..8832eb9 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,17 +1,32 @@ -FROM python:3.8-buster +FROM python:3.8.8-slim-buster as base + +# shared between builder and runtime image RUN apt-get update \ && apt-get install -y --no-install-recommends \ - dumb-init libgl1 \ + dumb-init \ + libgl1 \ + libglib2.0-0 \ + libsm6 \ && rm -rf /var/lib/apt/lists/* WORKDIR /opt/tf-bodypix + +# builder +FROM base as builder + COPY requirements.build.txt ./ -RUN pip install --disable-pip-version-check --user -r requirements.build.txt +RUN pip install --disable-pip-version-check --no-warn-script-location --user -r requirements.build.txt COPY requirements.txt ./ -RUN pip install --disable-pip-version-check --user -r requirements.txt +RUN pip install --disable-pip-version-check --no-warn-script-location --user -r requirements.txt + + +# runtime image +FROM base + +COPY --from=builder /root/.local /root/.local COPY tf_bodypix ./tf_bodypix diff --git a/README.md b/README.md index a1bff0d..798e493 100644 --- a/README.md +++ b/README.md @@ -310,8 +310,12 @@ You could also use the Docker image if you prefer. The entrypoint will by default delegate to the CLI, except for `python` or `bash` commands. ```bash +# pull latest image (you may also use tags) docker pull de4code/tf-bodypix +``` +```bash +# mount real and virtual webcam devices on linux docker run --rm \ --device /dev/video0 \ --device /dev/video2 \ @@ -323,6 +327,24 @@ docker run --rm \ --threshold=0.75 ``` +```bash +# mount x11 display on linux +docker run --rm \ + --net=host \ + --volume /tmp/.X11-unix:/tmp/.X11-unix \ + --volume ${HOME}/.Xauthority:/root/.Xauthority \ + --env DISPLAY \ + de4code/tf-bodypix \ + replace-background \ + --source \ + "https://www.dropbox.com/s/s7jga3f0dreavlb/video-of-a-man-laughing-and-happy-1608393-360p.mp4?dl=1" \ + --background \ + "https://www.dropbox.com/s/b22ss59j6pp83zy/brown-landscape-under-grey-sky-3244513.jpg?dl=1" \ + --show-output \ + --threshold=0.75 \ + --mask-blur=5 +``` + ## Example Media Here are a few example media files you could try.