Add accelerated_base Docker image with Intel QuickSync and NVIDIA CUDA support
All checks were successful
Gitea Actions Demo / Build (push) Successful in 21m21s
All checks were successful
Gitea Actions Demo / Build (push) Successful in 21m21s
- Ubuntu 22.04 base with Python 3.11 - Intel Media Driver and VAAPI for QuickSync hardware acceleration - NVIDIA CUDA support via container toolkit - FFmpeg with hardware codec support - OpenCV, PyTorch, and common ML/CV packages - Non-root user setup for security - Provides comprehensive base for ML/CV applications with hardware acceleration
This commit is contained in:
138
Dockerfile.accelerated_base
Normal file
138
Dockerfile.accelerated_base
Normal file
@@ -0,0 +1,138 @@
|
|||||||
|
# Accelerated Base Image with Intel QuickSync, NVIDIA CUDA, FFmpeg, and Python support
|
||||||
|
# Provides a comprehensive base for ML/CV applications with hardware acceleration
|
||||||
|
FROM ubuntu:22.04
|
||||||
|
|
||||||
|
LABEL maintainer="j"
|
||||||
|
LABEL description="Base image with Intel QuickSync, NVIDIA CUDA support, FFmpeg, and Python 3.11"
|
||||||
|
|
||||||
|
# Prevent interactive prompts during package installation
|
||||||
|
ENV DEBIAN_FRONTEND=noninteractive
|
||||||
|
|
||||||
|
# Install system dependencies including Intel and NVIDIA support
|
||||||
|
RUN apt-get update && apt-get install -y \
|
||||||
|
# Base utilities
|
||||||
|
curl \
|
||||||
|
wget \
|
||||||
|
git \
|
||||||
|
build-essential \
|
||||||
|
pkg-config \
|
||||||
|
software-properties-common \
|
||||||
|
# Python 3.11
|
||||||
|
python3.11 \
|
||||||
|
python3.11-dev \
|
||||||
|
python3-pip \
|
||||||
|
python3.11-venv \
|
||||||
|
# FFmpeg with hardware acceleration support
|
||||||
|
ffmpeg \
|
||||||
|
# Intel QuickSync / VAAPI dependencies
|
||||||
|
intel-media-va-driver-non-free \
|
||||||
|
vainfo \
|
||||||
|
libva-drm2 \
|
||||||
|
libva-dev \
|
||||||
|
libva2 \
|
||||||
|
i965-va-driver \
|
||||||
|
# OpenGL/Graphics libraries
|
||||||
|
libgl1 \
|
||||||
|
libglib2.0-0 \
|
||||||
|
libsm6 \
|
||||||
|
libxext6 \
|
||||||
|
libxrender-dev \
|
||||||
|
libgomp1 \
|
||||||
|
libglu1-mesa \
|
||||||
|
libglu1-mesa-dev \
|
||||||
|
libgl1-mesa-dev \
|
||||||
|
libgl1-mesa-glx \
|
||||||
|
# OpenCV dependencies
|
||||||
|
libopencv-dev \
|
||||||
|
libgstreamer1.0-0 \
|
||||||
|
libgstreamer-plugins-base1.0-0 \
|
||||||
|
libgstreamer-plugins-bad1.0-0 \
|
||||||
|
gstreamer1.0-plugins-base \
|
||||||
|
gstreamer1.0-plugins-good \
|
||||||
|
gstreamer1.0-plugins-bad \
|
||||||
|
gstreamer1.0-plugins-ugly \
|
||||||
|
gstreamer1.0-libav \
|
||||||
|
gstreamer1.0-tools \
|
||||||
|
# Video codec libraries
|
||||||
|
libx264-dev \
|
||||||
|
libx265-dev \
|
||||||
|
libvpx-dev \
|
||||||
|
libfdk-aac-dev \
|
||||||
|
libmp3lame-dev \
|
||||||
|
libopus-dev \
|
||||||
|
# Image format libraries
|
||||||
|
libjpeg-dev \
|
||||||
|
libpng-dev \
|
||||||
|
libtiff-dev \
|
||||||
|
libwebp-dev \
|
||||||
|
# Additional ML/numeric libraries
|
||||||
|
libhdf5-dev \
|
||||||
|
libatlas-base-dev \
|
||||||
|
gfortran \
|
||||||
|
&& rm -rf /var/lib/apt/lists/*
|
||||||
|
|
||||||
|
# Set Python 3.11 as default
|
||||||
|
RUN update-alternatives --install /usr/bin/python python /usr/bin/python3.11 1 && \
|
||||||
|
update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.11 1 && \
|
||||||
|
update-alternatives --install /usr/bin/pip pip /usr/bin/pip3 1
|
||||||
|
|
||||||
|
# Upgrade pip and install essential Python packages
|
||||||
|
RUN python -m pip install --upgrade pip setuptools wheel
|
||||||
|
|
||||||
|
# Install core Python ML/CV packages (CPU versions by default)
|
||||||
|
# CUDA versions can be overlaid at runtime or in derived images
|
||||||
|
RUN pip install --no-cache-dir \
|
||||||
|
numpy \
|
||||||
|
scipy \
|
||||||
|
pandas \
|
||||||
|
matplotlib \
|
||||||
|
pillow \
|
||||||
|
opencv-python-headless \
|
||||||
|
scikit-learn \
|
||||||
|
tqdm \
|
||||||
|
pyyaml \
|
||||||
|
requests
|
||||||
|
|
||||||
|
# Install PyTorch CPU version (can be overridden in derived images for CUDA)
|
||||||
|
RUN pip install --no-cache-dir \
|
||||||
|
torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cpu
|
||||||
|
|
||||||
|
# Set environment variables for hardware acceleration
|
||||||
|
# Intel QuickSync / VAAPI
|
||||||
|
ENV LIBVA_DRIVER_NAME=iHD
|
||||||
|
ENV LIBVA_DRIVERS_PATH=/usr/lib/x86_64-linux-gnu/dri
|
||||||
|
|
||||||
|
# Python environment
|
||||||
|
ENV PYTHONUNBUFFERED=1
|
||||||
|
ENV PYTHONDONTWRITEBYTECODE=1
|
||||||
|
|
||||||
|
# OpenCV
|
||||||
|
ENV OPENCV_VIDEOIO_PRIORITY_GSTREAMER=1
|
||||||
|
|
||||||
|
# FFmpeg hardware acceleration preference
|
||||||
|
ENV FFMPEG_HWACCEL_PRIORITY="vaapi,cuda,auto"
|
||||||
|
|
||||||
|
# NVIDIA Container Toolkit environment variables (will be used if NVIDIA runtime is available)
|
||||||
|
ENV NVIDIA_VISIBLE_DEVICES=all
|
||||||
|
ENV NVIDIA_DRIVER_CAPABILITIES=compute,utility,video
|
||||||
|
|
||||||
|
# Create a non-root user for running applications
|
||||||
|
RUN useradd -m -s /bin/bash -u 1000 appuser && \
|
||||||
|
usermod -a -G video appuser
|
||||||
|
|
||||||
|
# Create common directories
|
||||||
|
RUN mkdir -p /app /data /models && \
|
||||||
|
chown -R appuser:appuser /app /data /models
|
||||||
|
|
||||||
|
# Set working directory
|
||||||
|
WORKDIR /app
|
||||||
|
|
||||||
|
# Health check command to verify Python and FFmpeg are working
|
||||||
|
HEALTHCHECK --interval=30s --timeout=3s --start-period=5s --retries=3 \
|
||||||
|
CMD python -c "import torch, cv2, numpy; print('OK')" && ffmpeg -version > /dev/null 2>&1
|
||||||
|
|
||||||
|
# Default to non-root user (can be overridden in derived images)
|
||||||
|
USER appuser
|
||||||
|
|
||||||
|
# Default command - can be overridden in derived images
|
||||||
|
CMD ["/bin/bash"]
|
57
README.md
57
README.md
@@ -1,3 +1,56 @@
|
|||||||
# debian-curl
|
# Generic Docker Images
|
||||||
|
|
||||||
Debian with Curl
|
This repository contains reusable Docker base images for various purposes.
|
||||||
|
|
||||||
|
## Available Images
|
||||||
|
|
||||||
|
### debian-curl
|
||||||
|
|
||||||
|
Debian with curl installed.
|
||||||
|
|
||||||
|
### accelerated_base
|
||||||
|
|
||||||
|
A comprehensive base image with hardware acceleration support for ML/CV applications.
|
||||||
|
|
||||||
|
**Features:**
|
||||||
|
- Ubuntu 22.04 LTS base
|
||||||
|
- Python 3.11 with pip
|
||||||
|
- Intel QuickSync / VAAPI support for hardware video acceleration
|
||||||
|
- NVIDIA CUDA support (when NVIDIA Container Toolkit is available)
|
||||||
|
- FFmpeg with hardware acceleration codecs
|
||||||
|
- OpenCV with Python bindings
|
||||||
|
- PyTorch (CPU by default, GPU when NVIDIA runtime is available)
|
||||||
|
- Common ML/CV Python packages (numpy, scipy, pandas, matplotlib, etc.)
|
||||||
|
- Video and image codec libraries
|
||||||
|
- Non-root user setup for security
|
||||||
|
|
||||||
|
**Usage:**
|
||||||
|
```dockerfile
|
||||||
|
FROM gitea.jde.nz/public/accelerated_base:latest
|
||||||
|
|
||||||
|
# Your application-specific setup
|
||||||
|
COPY your_app.py /app/
|
||||||
|
CMD ["python", "/app/your_app.py"]
|
||||||
|
```
|
||||||
|
|
||||||
|
**Hardware Acceleration:**
|
||||||
|
- Intel QuickSync: Automatically available when `/dev/dri` is mounted
|
||||||
|
- NVIDIA GPU: Automatically available when using `--runtime=nvidia` or `--gpus all`
|
||||||
|
|
||||||
|
**Environment Variables:**
|
||||||
|
- `LIBVA_DRIVER_NAME=iHD` - Intel Media Driver for VAAPI
|
||||||
|
- `FFMPEG_HWACCEL_PRIORITY="vaapi,cuda,auto"` - Hardware acceleration preference
|
||||||
|
- `NVIDIA_VISIBLE_DEVICES=all` - NVIDIA GPU visibility
|
||||||
|
- `NVIDIA_DRIVER_CAPABILITIES=compute,utility,video` - NVIDIA capabilities
|
||||||
|
|
||||||
|
**Size:** ~2.5GB (includes Python, ML libraries, and video codecs)
|
||||||
|
|
||||||
|
## Building
|
||||||
|
|
||||||
|
Images are automatically built and published when pushed to this repository.
|
||||||
|
|
||||||
|
## Registry
|
||||||
|
|
||||||
|
Images are available at:
|
||||||
|
- `gitea.jde.nz/public/<image_name>:latest`
|
||||||
|
- `gitea.jde.nz/public/<image_name>:latest-<arch>` (architecture-specific)
|
Reference in New Issue
Block a user