Skip to content

Instantly share code, notes, and snippets.

@savage69kr
Forked from benperiton/Dockerfile
Created May 8, 2023 09:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save savage69kr/ec0ad19bb0b0d34de5372e6c4ced0f90 to your computer and use it in GitHub Desktop.
Save savage69kr/ec0ad19bb0b0d34de5372e6c4ced0f90 to your computer and use it in GitHub Desktop.
backgroundremover test
version: '3.3'
services:
backgroundremover:
build:
context: ./
dockerfile: Dockerfile
args:
- UID=1000
- GID=1001
container_name: "backgroundremover"
user: "1000:1001"
restart: "no"
volumes:
- './images:/app:rw'
working_dir: /app
FROM python:3.6-slim
ARG UID
ARG GID
RUN groupadd -g "${GID}" app \
&& useradd --create-home --no-log-init -u "${UID}" -g "${GID}" app
RUN apt-get update && \
apt-get -y install python3-pip && \
apt-get -y install ffmpeg imagemagick
USER app
RUN pip install pip
RUN pip install --default-timeout=1000 torch torchvision backgroundremover
WORKDIR /app
ENTRYPOINT ["tail"]
CMD ["-f","/dev/null"]
docker exec -it backgroundremover /bin/bash
/home/app/.local/bin/backgroundremover -i input.jpeg -m u2net_human_seg -o output.jpeg
convert output.jpeg -colorspace Gray -trim final.png
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment