-
Notifications
You must be signed in to change notification settings - Fork 2.1k
/
server.Dockerfile
50 lines (38 loc) 路 1.68 KB
/
server.Dockerfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
ARG CUDA_VERSION=11.6.0
FROM nvidia/cuda:${CUDA_VERSION}-devel-ubuntu20.04
ARG CAS_NAME=cas
WORKDIR /${CAS_NAME}
ENV PIP_NO_CACHE_DIR=1 \
PIP_DISABLE_PIP_VERSION_CHECK=1
# constant, wont invalidate cache
LABEL org.opencontainers.image.vendor="Jina AI Limited" \
org.opencontainers.image.licenses="Apache 2.0" \
org.opencontainers.image.title="CLIP-as-Service" \
org.opencontainers.image.description="Embed images and sentences into fixed-length vectors with CLIP" \
org.opencontainers.image.authors="hello@jina.ai" \
org.opencontainers.image.url="clip-as-service" \
org.opencontainers.image.documentation="https://clip-as-service.jina.ai/"
RUN apt-get update \
&& apt-get install -y --no-install-recommends python3 python3-pip wget \
&& ln -sf python3 /usr/bin/python \
&& ln -sf pip3 /usr/bin/pip \
&& pip install --upgrade pip \
&& pip install wheel setuptools nvidia-pyindex \
&& pip install torch torchvision torchaudio --extra-index-url https://download.pytorch.org/whl/cu113
COPY server ./server
# given by builder
ARG PIP_TAG
RUN pip install --default-timeout=1000 --compile ./server/ \
&& if [ -n "${PIP_TAG}" ]; then pip install --default-timeout=1000 --compile "./server[${PIP_TAG}]" ; fi
ENV LD_LIBRARY_PATH=/usr/local/cuda/lib64
ARG USER_ID=1000
ARG GROUP_ID=1000
ARG USER_NAME=${CAS_NAME}
ARG GROUP_NAME=${CAS_NAME}
RUN groupadd -g ${GROUP_ID} ${USER_NAME} &&\
useradd -l -u ${USER_ID} -g ${USER_NAME} ${GROUP_NAME} &&\
mkdir /home/${USER_NAME} &&\
chown ${USER_NAME}:${GROUP_NAME} /home/${USER_NAME} &&\
chown -R ${USER_NAME}:${GROUP_NAME} /${CAS_NAME}/
USER ${USER_NAME}
ENTRYPOINT ["python", "-m", "clip_server"]