Files
generic-docker-images/Dockerfile.accelerated_base
j d005721838
All checks were successful
Build-Publish-Multi-Arch / build (linux/arm64) (push) Successful in 3m21s
Build-Publish-Multi-Arch / build (linux/amd64) (push) Successful in 4m48s
Build-Publish-Multi-Arch / create-manifest (push) Successful in 23s
Update Dockerfile.accelerated_base
2025-09-27 09:59:26 +12:00

120 lines
3.9 KiB
Docker

# Multi-architecture accelerated base image with hardware encoding support
# Supports Intel QuickSync, NVIDIA CUDA, FFmpeg, and Python
FROM ubuntu:22.04
# Prevent interactive prompts during package installation
ENV DEBIAN_FRONTEND=noninteractive
# Install base dependencies and development tools
RUN apt-get update && apt-get install -y \
# Basic tools
curl \
wget \
git \
build-essential \
pkg-config \
cmake \
# Python and pip
python3 \
python3-pip \
python3-dev \
# Media libraries
libavcodec-dev \
libavformat-dev \
libavutil-dev \
libswscale-dev \
libavdevice-dev \
libavfilter-dev \
# VA-API libraries (common for both architectures)
vainfo \
libva-dev \
libva-drm2 \
libva-x11-2 \
# Additional libraries
libglib2.0-0 \
libsm6 \
libxext6 \
libxrender-dev \
libgomp1 \
# Clean up
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*
# Install architecture-specific packages
RUN ARCH=$(uname -m) && \
if [ "$ARCH" = "x86_64" ]; then \
# Intel Media SDK dependencies (for QuickSync on x86_64 only)
apt-get update && \
apt-get install -y intel-media-va-driver-non-free && \
apt-get clean && \
rm -rf /var/lib/apt/lists/*; \
elif [ "$ARCH" = "aarch64" ]; then \
# ARM64 may use different video acceleration drivers
echo "ARM64 detected: Using default VA-API drivers"; \
fi
# Install FFmpeg with hardware acceleration support
# Using static build for consistency across architectures
RUN ARCH=$(uname -m) && \
if [ "$ARCH" = "x86_64" ]; then \
wget -q https://github.com/BtbN/FFmpeg-Builds/releases/download/latest/ffmpeg-master-latest-linux64-gpl.tar.xz && \
tar -xf ffmpeg-master-latest-linux64-gpl.tar.xz && \
mv ffmpeg-master-latest-linux64-gpl/bin/* /usr/local/bin/ && \
rm -rf ffmpeg-master-latest-linux64-gpl*; \
elif [ "$ARCH" = "aarch64" ]; then \
wget -q https://github.com/BtbN/FFmpeg-Builds/releases/download/latest/ffmpeg-master-latest-linuxarm64-gpl.tar.xz && \
tar -xf ffmpeg-master-latest-linuxarm64-gpl.tar.xz && \
mv ffmpeg-master-latest-linuxarm64-gpl/bin/* /usr/local/bin/ && \
rm -rf ffmpeg-master-latest-linuxarm64-gpl*; \
fi
# Install NVIDIA CUDA support (will be ignored on non-NVIDIA systems)
# Using a minimal CUDA runtime that works on both architectures
RUN ARCH=$(uname -m) && \
if [ "$ARCH" = "x86_64" ]; then \
apt-get update && \
apt-get install -y --no-install-recommends \
cuda-compat-11-8 \
libnvidia-encode-515 \
libnvidia-decode-515 \
|| echo "CUDA packages not available, skipping"; \
elif [ "$ARCH" = "aarch64" ]; then \
echo "ARM64 CUDA support will be provided by host system if available"; \
fi && \
apt-get clean && \
rm -rf /var/lib/apt/lists/*
# Create non-root user for running applications
RUN useradd -m -s /bin/bash appuser
# Set up Python environment
RUN pip3 install --no-cache-dir --upgrade pip setuptools wheel
# Install commonly needed Python packages for media processing
RUN pip3 install --no-cache-dir \
numpy \
Pillow \
opencv-python-headless \
imageio \
imageio-ffmpeg
# Set working directory
WORKDIR /app
# Set environment variables for hardware acceleration
# Note: These are primarily for x86_64 Intel graphics
# ARM64 systems may use different drivers
ENV LIBVA_DRIVER_NAME=iHD
# Set architecture-appropriate driver path (before switching to non-root user)
RUN ARCH=$(uname -m) && \
if [ "$ARCH" = "x86_64" ]; then \
echo "export LIBVA_DRIVERS_PATH=/usr/lib/x86_64-linux-gnu/dri" >> /etc/environment; \
elif [ "$ARCH" = "aarch64" ]; then \
echo "export LIBVA_DRIVERS_PATH=/usr/lib/aarch64-linux-gnu/dri" >> /etc/environment; \
fi
# Switch to non-root user by default
USER appuser
# Default command
CMD ["/bin/bash"]