multiarch!
This commit is contained in:
@@ -24,13 +24,11 @@ RUN apt-get update && apt-get install -y \
|
||||
python3.11-venv \
|
||||
# FFmpeg with hardware acceleration support
|
||||
ffmpeg \
|
||||
# Intel QuickSync / VAAPI dependencies
|
||||
intel-media-va-driver-non-free \
|
||||
# VAAPI dependencies (generic, works on both x86_64 and arm64)
|
||||
vainfo \
|
||||
libva-drm2 \
|
||||
libva-dev \
|
||||
libva2 \
|
||||
i965-va-driver \
|
||||
# OpenGL/Graphics libraries
|
||||
libgl1 \
|
||||
libglib2.0-0 \
|
||||
@@ -71,6 +69,14 @@ RUN apt-get update && apt-get install -y \
|
||||
gfortran \
|
||||
&& rm -rf /var/lib/apt/lists/*
|
||||
|
||||
# Install architecture-specific Intel drivers (only on x86_64)
|
||||
RUN if [ "$(dpkg --print-architecture)" = "amd64" ]; then \
|
||||
apt-get update && apt-get install -y \
|
||||
intel-media-va-driver-non-free \
|
||||
i965-va-driver \
|
||||
&& rm -rf /var/lib/apt/lists/*; \
|
||||
fi
|
||||
|
||||
# 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 && \
|
||||
@@ -94,13 +100,12 @@ RUN pip install --no-cache-dir \
|
||||
requests
|
||||
|
||||
# Install PyTorch CPU version (can be overridden in derived images for CUDA)
|
||||
# Note: PyTorch provides different wheels for different architectures
|
||||
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
|
||||
# VAAPI driver configuration (paths will be set at runtime via entrypoint)
|
||||
|
||||
# Python environment
|
||||
ENV PYTHONUNBUFFERED=1
|
||||
@@ -124,6 +129,15 @@ RUN useradd -m -s /bin/bash -u 1000 appuser && \
|
||||
RUN mkdir -p /app /data /models && \
|
||||
chown -R appuser:appuser /app /data /models
|
||||
|
||||
# Create entrypoint script to set architecture-specific environment variables
|
||||
RUN echo '#!/bin/bash\n\
|
||||
export LIBVA_DRIVERS_PATH=/usr/lib/$(uname -m)-linux-gnu/dri\n\
|
||||
if [ "$(uname -m)" = "x86_64" ]; then\n\
|
||||
export LIBVA_DRIVER_NAME=iHD\n\
|
||||
fi\n\
|
||||
exec "$@"' > /entrypoint.sh && \
|
||||
chmod +x /entrypoint.sh
|
||||
|
||||
# Set working directory
|
||||
WORKDIR /app
|
||||
|
||||
@@ -134,5 +148,8 @@ HEALTHCHECK --interval=30s --timeout=3s --start-period=5s --retries=3 \
|
||||
# Default to non-root user (can be overridden in derived images)
|
||||
USER appuser
|
||||
|
||||
# Set entrypoint
|
||||
ENTRYPOINT ["/entrypoint.sh"]
|
||||
|
||||
# Default command - can be overridden in derived images
|
||||
CMD ["/bin/bash"]
|
Reference in New Issue
Block a user