Skip to content

armgit / rembg

Public Imported from GitHub
0

Rembg is a tool to remove images background

Fix Docker image

Jan Pokorny2995d97c50e77
diff --git a/.dockerignore b/.dockerignore
new file mode 100644
index 0000000..66eec88
--- /dev/null
+++ b/.dockerignore
@@ -0,0 +1,8 @@
+*
+!rembg
+!setup.py
+!setup.cfg
+!requirements.txt
+!versioneer.py
+!README.md
+!pixel.png
diff --git a/Dockerfile b/Dockerfile
index 0829843..c417829 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -1,7 +1,20 @@
FROM nvidia/cuda:11.4.2-cudnn8-runtime-ubuntu20.04
-RUN apt-get update && apt-get install -y --no-install-recommends python3 python3-pip python3-dev llvm llvm-dev
-RUN pip3 install rembg
+RUN apt-get update &&\
+ apt-get install -y --no-install-recommends \
+ python3 \
+ python3-pip \
+ python3-dev \
+ build-essential
+
+WORKDIR /rembg
+
+COPY . .
+
+RUN pip3 install .
+
+# First run to compile AOT & download model
+RUN rembg pixel.png >/dev/null
ENTRYPOINT ["rembg"]
CMD []
diff --git a/README.md b/README.md
index f6111e3..646bf7c 100644
--- a/README.md
+++ b/README.md
@@ -158,10 +158,16 @@ python app.py
### Usage as a docker
-Just run
+First compile with:
```
-curl -s http://input.png | docker run -i -v ~/.u2net:/root/.u2net danielgatis/rembg:latest > output.png
+docker build . -t rembg
+```
+
+Then run with:
+
+```
+docker run --rm -i rembg <in.png >out.png
```
### Advance usage
diff --git a/pixel.png b/pixel.png
new file mode 100644
index 0000000..26a8c68
Binary files /dev/null and b/pixel.png differ
diff --git a/requirements.txt b/requirements.txt
index be1154a..f2e89b8 100644
--- a/requirements.txt
+++ b/requirements.txt
@@ -1,6 +1,6 @@
flask==1.1.2
-numpy==1.22.0
-pillow==8.1.2
+numpy==1.20.0
+pillow==8.3.2
scikit-image==0.19.1
torch==1.9.1
torchvision==0.10.1