File size: 1,607 Bytes
6e01822
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
51
52
FROM nvidia/cuda:11.3.1-cudnn8-devel-ubuntu18.04
CMD nvidia-smi

ENV DEBIAN_FRONTEND noninteractive
RUN apt-get update && apt-get install -y \
        git \
        make build-essential libssl-dev zlib1g-dev \
        libbz2-dev libreadline-dev libsqlite3-dev wget curl llvm \
        libncursesw5-dev xz-utils tk-dev libxml2-dev libxmlsec1-dev libffi-dev liblzma-dev  \
    	ffmpeg libsm6 libxext6 cmake libgl1-mesa-glx \
		&& rm -rf /var/lib/apt/lists/*
        && git lfs install


RUN useradd -ms /bin/bash user
USER user

ENV HOME=/home/user \
	PATH=/home/user/.local/bin:$PATH

RUN curl https://pyenv.run | bash
ENV PATH=$HOME/.pyenv/shims:$HOME/.pyenv/bin:$PATH
RUN pyenv install 3.8.15 && \
    pyenv global 3.8.15 && \
    pyenv rehash && \
    pip install --no-cache-dir --upgrade pip setuptools wheel

ENV WORKDIR=/code
WORKDIR $WORKDIR
RUN chown -R user:user $WORKDIR
RUN chmod -R 777 $WORKDIR

COPY requirements.txt $WORKDIR/requirements.txt
RUN pip install --no-cache-dir --upgrade -r $WORKDIR/requirements.txt
RUN pip install ninja

RUN curl https://github.com/isl-org/DPT/releases/download/1_0/dpt_hybrid-midas-501f0c75.pt --create-dirs -o $WORKDIR/midas_models/dpt_hybrid-midas-501f0c75.pt 
RUN curl https://github.com/isl-org/DPT/releases/download/1_0/dpt_large-midas-2f21e586.pt --create-dirs -o $WORKDIR/midas_models/dpt_large-midas-2f21e586.pt

COPY . .

ARG TORCH_CUDA_ARCH_LIST=7.5+PTX

USER root
RUN chown -R user:user $HOME
RUN chmod -R 777 $HOME
RUN chown -R user:user $WORKDIR
RUN chmod -R 777 $WORKDIR

USER user

CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]