OneFormer / Dockerfile
AbbSalehi's picture
Update Dockerfile
f8ab494 verified
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 \
python3 python3-pip python3-dev \
&& rm -rf /var/lib/apt/lists/*
RUN useradd -ms /bin/bash user
USER user
ENV HOME=/home/user \
PATH=/home/user/.local/bin:$PATH
ENV WORKDIR=/code
WORKDIR $WORKDIR
RUN python3 -m pip install --no-cache-dir torch==1.9.0+cu111 torchvision==0.10.0+cu111 torchaudio==0.9.0 \
--extra-index-url https://download.pytorch.org/whl/cu111
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 --no-cache-dir --no-build-isolation -r $WORKDIR/requirements.txt
RUN pip install ninja
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
RUN ln -s $WORKDIR/oneformer/modeling/pixel_decoder/ops/ $WORKDIR/ && ls && cd ops/ && FORCE_CUDA=1 python setup.py build --build-base=$WORKDIR/ install --user && cd ..
#RUN sh deform_setup.sh
USER user
RUN sh deform_setup.sh
RUN mkdir -p examples
RUN wget https://praeclarumjj3.github.io/files/ade20k.jpeg -P $WORKDIR/examples/
RUN wget https://praeclarumjj3.github.io/files/cityscapes.png -P $WORKDIR/examples/
RUN wget https://praeclarumjj3.github.io/files/coco.jpeg -P $WORKDIR/examples/
USER user
EXPOSE 7860
ENTRYPOINT ["python", "gradio_app.py"]