File size: 1,916 Bytes
4041a47 26081ba 4041a47 ac0a06d 4041a47 26081ba 4041a47 f4b850c dba9850 f4b850c 4041a47 |
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 53 54 55 56 57 58 59 60 61 62 63 64 65 |
ARG CUDA_IMAGE="12.1.1-devel-ubuntu22.04"
FROM nvidia/cuda:${CUDA_IMAGE}
# We need to set the host to 0.0.0.0 to allow outside access
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 . .
# setting build related env vars
ENV CUDA_DOCKER_ARCH=all
# Install depencencies
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
# Install PyTorch for CUDA 11.3
RUN python -m pip install torch==2.0.1 torchvision==0.15.2 torchaudio --extra-index-url https://download.pytorch.org/whl/cu121
# Install MMCV MMDetection
RUN pip install -U openmim
RUN mim install mmcv-full==1.7.2
RUN mim install mmdet==2.28.2
# Install MMRotate
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
# Switch to the "user" user
USER user
# Specific requirements for current project
COPY requirements.txt .
RUN python -m pip install --user -r requirements.txt
# Set home to the user's home directory
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 the current directory contents into the container at $HOME/app setting the owner to the user
COPY --chown=user . $HOME/app
CMD ["python3", "app.py"] |