Download Dockerfile from darkusha/saml: direct link, hf CLI and curl.
- Browser
- Download file 2.36 kB
-
https://huggingface.co/spaces/darkusha/saml/resolve/main/Dockerfile
- Command line
-
hf download hf://spaces/darkusha/saml/Dockerfile
-
curl -L -o Dockerfile https://huggingface.co/spaces/darkusha/saml/resolve/main/Dockerfile
2.36 kB
| FROM pytorch/pytorch:2.1.2-cuda12.1-cudnn8-runtime | |
| ARG DEBIAN_FRONTEND=noninteractive | |
| ARG TEST_ENV | |
| WORKDIR /app | |
| RUN conda update conda -y | |
| RUN --mount=type=cache,target="/var/cache/apt",sharing=locked \ | |
| --mount=type=cache,target="/var/lib/apt/lists",sharing=locked \ | |
| apt-get -y update \ | |
| && apt-get install -y git \ | |
| && apt-get install -y wget \ | |
| && apt-get install -y g++ freeglut3-dev build-essential libx11-dev \ | |
| libxmu-dev libxi-dev libglu1-mesa libglu1-mesa-dev libfreeimage-dev \ | |
| && apt-get -y install ffmpeg libsm6 libxext6 libffi-dev python3-dev python3-pip gcc | |
| ENV PYTHONUNBUFFERED=1 \ | |
| PYTHONDONTWRITEBYTECODE=1 \ | |
| PIP_CACHE_DIR=/.cache \ | |
| PORT=7860 \ | |
| WORKERS=2 \ | |
| THREADS=4 \ | |
| CUDA_HOME=/usr/local/cuda \ | |
| GROUNDINGDINO_REPO_PATH=/GroundingDINO | |
| RUN conda install -c "nvidia/label/cuda-12.1.1" cuda -y | |
| ENV CUDA_HOME=/opt/conda \ | |
| TORCH_CUDA_ARCH_LIST="6.0;6.1;7.0;7.5;8.0;8.6+PTX;8.9;9.0" | |
| COPY requirements.txt . | |
| RUN --mount=type=cache,target=${PIP_CACHE_DIR},sharing=locked \ | |
| pip3 install --no-cache-dir -r requirements.txt | |
| # install GroundingDINO | |
| RUN cd / && git clone https://github.com/IDEA-Research/GroundingDINO.git | |
| WORKDIR /GroundingDINO | |
| RUN --mount=type=cache,target=${PIP_CACHE_DIR},sharing=locked \ | |
| pip3 install -e . | |
| RUN mkdir weights | |
| WORKDIR /GroundingDINO/weights | |
| RUN wget -q https://github.com/IDEA-Research/GroundingDINO/releases/download/v0.1.0-alpha/groundingdino_swint_ogc.pth | |
| WORKDIR /app | |
| RUN wget -q https://github.com/ChaoningZhang/MobileSAM/raw/master/weights/mobile_sam.pt | |
| RUN wget -q https://dl.fbaipublicfiles.com/segment_anything/sam_vit_h_4b8939.pth | |
| # install test requirements if needed | |
| COPY requirements-test.txt . | |
| # build only when TEST_ENV="true" | |
| RUN --mount=type=cache,target=${PIP_CACHE_DIR},sharing=locked \ | |
| if [ "$TEST_ENV" = "true" ]; then \ | |
| pip3 install -r requirements-test.txt; \ | |
| fi | |
| COPY . ./ | |
| # Создаём директорию для базы данных и устанавливаем права доступа | |
| RUN mkdir -p /tmp/data/models | |
| COPY data/ml-backend/models/cache.db /tmp/data/models/cache.db | |
| RUN chmod 777 /tmp/data/models/cache.db | |
| # Устанавливаем переменную окружения для пути к базе данных | |
| ENV DATABASE_PATH=/tmp/data/models/cache.db | |
| CMD ["/app/start.sh"] | |