Created
March 22, 2025 00:33
-
-
Save Bosek/d90d593d69fc64379751f2508b16b946 to your computer and use it in GitHub Desktop.
Dockerfile for bosek/ai-base
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # syntax=docker/dockerfile:1 | |
| #FROM nvidia/cuda:12.8.1-runtime-ubuntu24.04 | |
| FROM pytorch/pytorch:2.6.0-cuda12.6-cudnn9-runtime | |
| # Avoid DDP error "MKL_THREADING_LAYER=INTEL is incompatible with libgomp.so.1 library" https://github.com/pytorch/pytorch/issues/37377 | |
| ENV PYTHONUNBUFFERED=1 \ | |
| PYTHONDONTWRITEBYTECODE=1 \ | |
| PIP_BREAK_SYSTEM_PACKAGES=1 \ | |
| MKL_THREADING_LAYER=GNU \ | |
| OMP_NUM_THREADS=1 | |
| # Install linux packages | |
| # g++ required to build 'tflite_support' and 'lap' packages, libusb-1.0-0 required for 'tflite_support' package | |
| RUN apt-get update && apt-get install -y --no-install-recommends \ | |
| git zip unzip wget curl htop libgl1 libglib2.0-0 libusb-1.0-0 xz-utils \ | |
| && rm -rf /var/lib/apt/lists/* | |
| RUN mkdir /ffmpeg && mkdir /usr/local/ffmpeg && cd /ffmpeg && \ | |
| curl -L https://github.com/BtbN/FFmpeg-Builds/releases/download/latest/ffmpeg-master-latest-linux64-gpl.tar.xz | \ | |
| tar -xJ --strip-components=1 && \ | |
| cp /ffmpeg/bin/ffmpeg /ffmpeg/bin/ffprobe /usr/local/ffmpeg/ && \ | |
| rm -rf /ffmpeg | |
| ENV PATH="/usr/local/ffmpeg:${PATH}" | |
| # Ultralytics | |
| ADD https://github.com/ultralytics/assets/releases/download/v0.0.0/Arial.ttf \ | |
| https://github.com/ultralytics/assets/releases/download/v0.0.0/Arial.Unicode.ttf \ | |
| /root/.config/Ultralytics/ | |
| # https://security.snyk.io/vuln/SNYK-UBUNTU1804-OPENSSL-3314796ú | |
| RUN apt upgrade -y --no-install-recommends openssl tar && rm -rf /var/lib/apt/lists/* | |
| RUN --mount=type=cache,target=/root/.cache/pip \ | |
| pip install --pre --force-reinstall torch torchvision torchaudio --index-url https://download.pytorch.org/whl/nightly/cu128 && \ | |
| pip install -U albumentations &&\ | |
| pip install easyocr imutils opencv_python_headless lapx ultralytics | |
| #RUN --mount=type=cache,target=/root/.config/uv \ | |
| # uv pip install --system -e ".[export]" "albumentations>=1.4.6" comet pycocotools | |
| # Run exports to AutoInstall packages | |
| RUN --mount=type=cache,target=/root/.cache/pip \ | |
| --mount=type=cache,target=/root/.config/Ultralytics \ | |
| yolo export model=/root/.config/Ultralytics/tmp/yolo11n.pt format=edgetpu imgsz=32 || true | |
| RUN --mount=type=cache,target=/root/.cache/pip \ | |
| --mount=type=cache,target=/root/.config/Ultralytics \ | |
| yolo export model=/root/.config/Ultralytics/tmp/yolo11n.pt format=ncnn imgsz=32 || true | |
| RUN --mount=type=cache,target=/root/.cache/pip \ | |
| --mount=type=cache,target=/root/.config/Ultralytics \ | |
| yolo predict model=/root/.config/Ultralytics/tmp/yolov11n.pt source=https://ultralytics.com/images/zidane.jpg save=False || true | |
| WORKDIR /app |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment