|
ARG CUDA_IMAGE="12.1.1-devel-ubuntu22.04" |
|
FROM nvidia/cuda:${CUDA_IMAGE} |
|
|
|
|
|
ENV HOST 0.0.0.0 |
|
|
|
RUN apt-get update && apt-get upgrade -y \ |
|
&& apt-get install -y git build-essential \ |
|
python3 python3-pip gcc wget python-is-python3 \ |
|
ocl-icd-opencl-dev opencl-headers clinfo \ |
|
libclblast-dev libopenblas-dev \ |
|
libgl1 libgl1-mesa-glx libglib2.0-0 \ |
|
&& mkdir -p /etc/OpenCL/vendors && echo "libnvidia-opencl.so.1" > /etc/OpenCL/vendors/nvidia.icd |
|
COPY . . |
|
|
|
|
|
ENV CUDA_DOCKER_ARCH=all |
|
|
|
|
|
RUN python -m pip install --upgrade pip pytest cmake \ |
|
scikit-build setuptools fastapi uvicorn sse-starlette \ |
|
pydantic-settings starlette-context gradio huggingface_hub hf_transfer |
|
|
|
|
|
RUN python -m pip install torch==2.0.1 torchvision==0.15.2 torchaudio --extra-index-url https://download.pytorch.org/whl/cu121 |
|
|
|
|
|
RUN pip install -U openmim |
|
RUN mim install mmcv-full==1.7.2 |
|
RUN mim install mmdet==2.28.2 |
|
|
|
|
|
RUN git clone https://github.com/open-mmlab/mmrotate.git |
|
WORKDIR mmrotate |
|
|
|
ENV FORCE_CUDA="1" |
|
RUN pip install -r requirements/build.txt |
|
RUN pip install --no-cache-dir -e . |
|
|
|
RUN useradd -m -u 1000 user |
|
|
|
|
|
USER user |
|
|
|
|
|
COPY requirements.txt . |
|
RUN python -m pip install --user -r requirements.txt |
|
|
|
|
|
ENV HOME=/home/user \ |
|
PATH=/home/user/.local/bin:$PATH \ |
|
PYTHONPATH=$HOME/app \ |
|
PYTHONUNBUFFERED=1 \ |
|
GRADIO_ALLOW_FLAGGING=never \ |
|
GRADIO_NUM_PORTS=1 \ |
|
GRADIO_SERVER_NAME=0.0.0.0 \ |
|
GRADIO_THEME=huggingface \ |
|
SYSTEM=spaces |
|
|
|
WORKDIR $HOME/app |
|
|
|
|
|
COPY --chown=user . $HOME/app |
|
|
|
CMD ["python3", "app.py"] |