jina-ai / clip-as-service

🏄 Scalable embedding, reasoning, ranking for images and sentences with CLIP

Home Page:https://clip-as-service.jina.ai

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

How to properly build the cuda.dockerfile

themantalope opened this issue · comments

Getting an error when trying to build locally:

docker build . -f Dockerfiles/cuda.Dockerfile --tag clipasservice:latest
[+] Building 2.1s (11/12)                                                                                                                                                                                          
 => [internal] load build definition from cuda.Dockerfile                                                                                                                                                     0.0s
 => => transferring dockerfile: 1.64kB                                                                                                                                                                        0.0s
 => [internal] load .dockerignore                                                                                                                                                                             0.0s
 => => transferring context: 65B                                                                                                                                                                              0.0s
 => [internal] load metadata for nvcr.io/nvidia/cuda:11.4.2-cudnn8-runtime-ubuntu20.04                                                                                                                        0.9s
 => [1/8] FROM nvcr.io/nvidia/cuda:11.4.2-cudnn8-runtime-ubuntu20.04@sha256:383fa307b6c341d937cefe7db3d4fdf17ce7e8daf195259fe709da9ba169545f                                                                  0.0s
 => [internal] load build context                                                                                                                                                                             0.0s
 => => transferring context: 3.19kB                                                                                                                                                                           0.0s
 => CACHED [2/8] RUN apt-get update && apt-get install -y --no-install-recommends     python3-setuptools python3-wheel python3-pip     && apt-get clean && rm -rf /var/lib/apt/lists/*;                       0.0s
 => CACHED [3/8] RUN python3 -m pip install --default-timeout=1000 --no-cache-dir torch torchvision torchaudio nvidia-pyindex transformers --extra-index-url https://download.pytorch.org/whl/cu113           0.0s
 => CACHED [4/8] RUN python3 -m pip install --default-timeout=1000 --no-cache-dir "jina[standard]==3.11.0"                                                                                                    0.0s
 => CACHED [5/8] COPY . /cas/                                                                                                                                                                                 0.0s
 => CACHED [6/8] WORKDIR /cas                                                                                                                                                                                 0.0s
 => ERROR [7/8] RUN if [ "torch" != "torch" ]; then python3 -m pip install --no-cache-dir "./[torch]" ; fi     && python3 -m pip install --no-cache-dir .                                                     1.1s
------
 > [7/8] RUN if [ "torch" != "torch" ]; then python3 -m pip install --no-cache-dir "./[torch]" ; fi     && python3 -m pip install --no-cache-dir .:
#0 1.053 ERROR: Directory '.' is not installable. Neither 'setup.py' nor 'pyproject.toml' found.
------
cuda.Dockerfile:30
--------------------
  29 |     
  30 | >>> RUN if [ "${BACKEND_TAG}" != "torch" ]; then python3 -m pip install --no-cache-dir "./[${BACKEND_TAG}]" ; fi \
  31 | >>>     && python3 -m pip install --no-cache-dir .
  32 |     
--------------------
ERROR: failed to solve: process "/bin/sh -c if [ \"${BACKEND_TAG}\" != \"torch\" ]; then python3 -m pip install --no-cache-dir \"./[${BACKEND_TAG}]\" ; fi     && python3 -m pip install --no-cache-dir ." did not complete successfully: exit code: 1

Hi @themantalope ,

Can you do cp Dockerfiles/cuda.Dockerfile server/Dockerfile and go from there?

Yep it works, as long as you are in the server directory. Don't need to copy the Dockerfiles. Seems like the server dir is the correct build context

cd server
docker build . -f ../Dockerfiles/cuda.Dockerfile -t clip-as-service-gpu:latest

I put in a PR with updated readme.