feat(*): rewritten the project with C/C++ (#1172)

This commit is contained in:
K4YT3X
2024-10-07 19:29:00 -07:00
committed by GitHub
parent 721de8cbce
commit a7952fc493
80 changed files with 6664 additions and 5734 deletions

View File

@@ -1,44 +1,45 @@
# Name: Video2X Dockerfile
# Creator: K4YT3X
# Date Created: February 3, 2022
# Last Modified: February 9, 2024
# Last Modified: October 7, 2024
# stage 1: build the python components into wheels
FROM docker.io/nvidia/vulkan:1.3-470 AS builder
ENV DEBIAN_FRONTEND=noninteractive
FROM docker.io/archlinux:latest AS builder
COPY . /video2x
# Install dependencies and create a non-root user
RUN pacman -Syy --noconfirm \
base-devel ffmpeg ncnn git cmake make clang pkgconf vulkan-headers openmp sudo \
nvidia-utils vulkan-radeon vulkan-intel vulkan-swrast \
&& useradd -m builder \
&& echo 'builder ALL=(ALL) NOPASSWD: ALL' > /etc/sudoers.d/builder
# Switch to the non-root user and copy the source code
USER builder
COPY --chown=builder:builder . /video2x
WORKDIR /video2x
RUN gpg --keyserver=keyserver.ubuntu.com --receive-keys A4B469963BF863CC \
&& gpg --export A4B469963BF863CC > /etc/apt/trusted.gpg.d/cuda.gpg
RUN apt-get update \
&& apt-get install -y --no-install-recommends \
python3.9 python3-pip python3-opencv python3-pil \
python3.9-dev libvulkan-dev glslang-dev glslang-tools \
build-essential swig \
&& python3.9 -m pip wheel -w /wheels wheel pdm-backend '.[all]'
# Build the package
RUN makepkg -s --noconfirm \
&& find /video2x -maxdepth 1 -name '*.pkg.tar.zst' | head -n 1 | \
xargs -I {} cp {} /tmp/video2x.pkg.tar.zst
# stage 2: install wheels into the final image
FROM docker.io/nvidia/vulkan:1.3-470
FROM docker.io/archlinux:latest
LABEL maintainer="K4YT3X <i@k4yt3x.com>" \
org.opencontainers.image.source="https://github.com/k4yt3x/video2x" \
org.opencontainers.image.description="A lossless video/GIF/image upscaler"
ENV DEBIAN_FRONTEND=noninteractive
org.opencontainers.image.description="A lossless video super resolution framework"
ENV VK_ICD_FILENAMES=/usr/share/vulkan/icd.d/nvidia_icd.json\
:/usr/share/vulkan/icd.d/radeon_icd.x86_64.json\
:/usr/share/vulkan/icd.d/intel_icd.x86_64.json
COPY --from=builder /var/lib/apt/lists* /var/lib/apt/lists/
COPY --from=builder /wheels /wheels
COPY --from=builder /tmp/video2x.pkg.tar.zst /video2x.pkg.tar.zst
COPY . /video2x
WORKDIR /video2x
RUN apt-get install -y --no-install-recommends \
python3.9 python3-pip python3.9-dev \
python3-opencv python3-pil \
mesa-vulkan-drivers cuda-drivers ffmpeg \
&& python3.9 -m pip install --no-cache-dir --no-index -f /wheels '.[all]' \
&& apt-get clean \
&& rm -rf /wheels /video2x /var/lib/apt/lists/*
RUN pacman -Sy --noconfirm ffmpeg ncnn \
nvidia-utils vulkan-radeon vulkan-intel vulkan-swrast \
&& pacman -U --noconfirm /video2x.pkg.tar.zst \
&& rm -rf /video2x.pkg.tar.zst /var/cache/pacman/pkg/*
WORKDIR /host
ENTRYPOINT ["/usr/bin/python3.9", "-m", "video2x"]
ENTRYPOINT ["/usr/bin/video2x"]