Browse Source

Fix Docker image

Jan Pokorny2 3 years ago
parent
commit
995d97c50e
5 changed files with 33 additions and 6 deletions
  1. 8 0
      .dockerignore
  2. 15 2
      Dockerfile
  3. 8 2
      README.md
  4. BIN
      pixel.png
  5. 2 2
      requirements.txt

+ 8 - 0
.dockerignore

@@ -0,0 +1,8 @@
+*
+!rembg
+!setup.py
+!setup.cfg
+!requirements.txt
+!versioneer.py
+!README.md
+!pixel.png

+ 15 - 2
Dockerfile

@@ -1,7 +1,20 @@
 FROM nvidia/cuda:11.4.2-cudnn8-runtime-ubuntu20.04
 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"]
 ENTRYPOINT ["rembg"]
 CMD []
 CMD []

+ 8 - 2
README.md

@@ -158,10 +158,16 @@ python app.py
 
 
 ### Usage as a docker
 ### 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
 ### Advance usage

BIN
pixel.png


+ 2 - 2
requirements.txt

@@ -1,6 +1,6 @@
 flask==1.1.2
 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
 scikit-image==0.19.1
 torch==1.9.1
 torch==1.9.1
 torchvision==0.10.1
 torchvision==0.10.1