-
-
Notifications
You must be signed in to change notification settings - Fork 1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: added Dockerfile, PKGBUILD, and GHA workflows
Signed-off-by: k4yt3x <[email protected]>
- Loading branch information
Showing
6 changed files
with
191 additions
and
20 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
name: build | ||
on: | ||
push: | ||
branches: | ||
- master | ||
- dev | ||
pull_request: {} | ||
workflow_dispatch: {} | ||
jobs: | ||
ubuntu: | ||
runs-on: ubuntu-latest | ||
env: | ||
DEBIAN_FRONTEND: noninteractive | ||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v2 | ||
with: | ||
submodules: recursive | ||
- name: Install dependencies | ||
run: | | ||
git submodule update --init --recursive | ||
sudo apt-get update | ||
sudo apt-get install -y --no-install-recommends \ | ||
libavcodec-dev \ | ||
libavdevice-dev \ | ||
libavfilter-dev \ | ||
libavformat-dev \ | ||
libavutil-dev \ | ||
libswscale-dev \ | ||
libvulkan-dev \ | ||
glslang-tools | ||
- name: Build Video2X | ||
run: | | ||
mkdir -p /tmp/build /tmp/install | ||
cmake -B /tmp/build -S . -DUSE_SYSTEM_NCNN=OFF \ | ||
-DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=/tmp/install | ||
cmake --build /tmp/build --config Release --target install --parallel | ||
- name: Package artifacts | ||
run: | | ||
tar cJvf /tmp/video2x-nightly.txz -C /tmp/install . | ||
- name: Upload artifacts | ||
uses: actions/upload-artifact@v2 | ||
with: | ||
name: video2x-nightly | ||
path: /tmp/video2x-nightly.txz |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
name: Release | ||
on: | ||
push: | ||
tags: | ||
- "*" | ||
|
||
jobs: | ||
setup: | ||
if: github.event.base_ref == 'refs/heads/master' | ||
name: Setup | ||
runs-on: ubuntu-latest | ||
outputs: | ||
tag: ${{ steps.get_tag.outputs.tag }} | ||
steps: | ||
- name: Get tag | ||
id: get_tag | ||
run: echo ::set-output name=tag::${GITHUB_REF/refs\/tags\//} | ||
|
||
container: | ||
name: Build and upload container | ||
needs: | ||
- setup | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v2 | ||
- uses: mr-smithers-excellent/docker-build-push@v5 | ||
name: Build & push the Docker image | ||
with: | ||
registry: ghcr.io | ||
username: ${{ secrets.GHCR_USER }} | ||
password: ${{ secrets.GHCR_TOKEN }} | ||
dockerfile: Dockerfile | ||
image: video2x | ||
tags: latest, ${{ needs.setup.outputs.tag }} | ||
|
||
create-release: | ||
name: Create release | ||
needs: | ||
- setup | ||
- container | ||
runs-on: ubuntu-latest | ||
outputs: | ||
upload_url: ${{ steps.create_release.outputs.upload_url }} | ||
steps: | ||
- name: Create release | ||
id: create_release | ||
uses: actions/create-release@v1 | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
with: | ||
tag_name: ${{ needs.setup.outputs.tag }} | ||
release_name: Video2X ${{ needs.setup.outputs.tag }} | ||
draft: true | ||
prerelease: false |
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
# Name: Video2X Dockerfile | ||
# Creator: K4YT3X | ||
# Date Created: February 3, 2022 | ||
# Last Modified: October 7, 2024 | ||
|
||
# stage 1: build the python components into wheels | ||
FROM docker.io/archlinux:latest AS builder | ||
|
||
# Install dependencies and create a non-root user | ||
RUN pacman -Syy --noconfirm \ | ||
base-devel ffmpeg ncnn git cmake make clang pkgconf vulkan-headers 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 | ||
|
||
# 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/archlinux:latest | ||
LABEL maintainer="K4YT3X <[email protected]>" \ | ||
org.opencontainers.image.source="https://github.com/k4yt3x/video2x" \ | ||
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 /tmp/video2x.pkg.tar.zst /video2x.pkg.tar.zst | ||
COPY . /video2x | ||
WORKDIR /video2x | ||
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/video2x"] |
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
pkgname=video2x | ||
pkgver=r862.f590ead | ||
pkgrel=1 | ||
pkgdesc="A lossless video super resolution framework" | ||
arch=('x86_64') | ||
url="https://github.com/k4yt3x/video2x" | ||
license=('AGPL3') | ||
depends=('ffmpeg' 'ncnn' 'vulkan-driver') | ||
makedepends=('git' 'cmake' 'make' 'clang' 'pkgconf' 'vulkan-headers') | ||
|
||
pkgver() { | ||
printf "r%s.%s" "$(git rev-list --count HEAD)" "$(git rev-parse --short HEAD)" | ||
} | ||
|
||
prepare() { | ||
git submodule update --init --recursive | ||
} | ||
|
||
build() { | ||
cmake -B build -S .. -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=/usr | ||
cmake --build build --config Release --parallel | ||
} | ||
|
||
package() { | ||
DESTDIR="$pkgdir" cmake --install build | ||
} | ||
|