-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
11 changed files
with
705 additions
and
0 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,76 @@ | ||
name: Build and Push Dev Docker Image | ||
|
||
on: | ||
schedule: | ||
- cron: '0 */2 * * *' # Run every 2 hours | ||
workflow_dispatch: # Allow manual triggering | ||
|
||
env: | ||
REGISTRY: ghcr.io | ||
IMAGE_NAME: ${{ github.repository }} | ||
|
||
jobs: | ||
build-and-push-dev: | ||
runs-on: ubuntu-latest | ||
permissions: | ||
contents: write | ||
packages: write | ||
|
||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v3 | ||
|
||
- name: Get last commit info | ||
id: last_commit | ||
run: | | ||
LAST_COMMIT_TIME=$(git log -1 --format=%ct) | ||
CURRENT_TIME=$(date +%s) | ||
TIME_DIFF=$((CURRENT_TIME - LAST_COMMIT_TIME)) | ||
if [ $TIME_DIFF -ge 14400 ]; then # 14400 seconds = 4 hours | ||
echo "build=true" >> $GITHUB_OUTPUT | ||
else | ||
echo "build=false" >> $GITHUB_OUTPUT | ||
fi | ||
echo "LAST_COMMIT_HASH=$(git rev-parse HEAD)" >> $GITHUB_OUTPUT | ||
- name: Check for updates | ||
id: check | ||
if: steps.last_commit.outputs.build == 'true' | ||
run: | | ||
if [ ! -f .last_dev_build ] || [ "$(cat .last_dev_build)" != "${{ steps.last_commit.outputs.LAST_COMMIT_HASH }}" ]; then | ||
echo "update=true" >> $GITHUB_OUTPUT | ||
else | ||
echo "update=false" >> $GITHUB_OUTPUT | ||
fi | ||
- name: Prepare Docker metadata | ||
id: meta | ||
run: | | ||
echo "IMAGE_ID=$(echo ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} | tr '[A-Z]' '[a-z]')" >> $GITHUB_OUTPUT | ||
- name: Log in to the Container registry | ||
if: steps.check.outputs.update == 'true' | ||
uses: docker/login-action@v2 | ||
with: | ||
registry: ${{ env.REGISTRY }} | ||
username: ${{ github.actor }} | ||
password: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- name: Build and push Docker image | ||
if: steps.check.outputs.update == 'true' | ||
uses: docker/build-push-action@v4 | ||
with: | ||
context: . | ||
push: true | ||
tags: ${{ steps.meta.outputs.IMAGE_ID }}:dev | ||
file: ./dockerfile.dev | ||
|
||
- name: Update last build info | ||
if: steps.check.outputs.update == 'true' | ||
run: | | ||
echo "${{ steps.last_commit.outputs.LAST_COMMIT_HASH }}" > .last_dev_build | ||
git config user.name github-actions | ||
git config user.email [email protected] | ||
git add .last_dev_build | ||
git commit -m "Update last dev build info" | ||
git push |
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,69 @@ | ||
name: Build and Push Pre-release Docker Image | ||
|
||
on: | ||
schedule: | ||
- cron: '0 */2 * * *' # Run every 2 hours | ||
workflow_dispatch: # Allow manual triggering | ||
|
||
env: | ||
REGISTRY: ghcr.io | ||
IMAGE_NAME: ${{ github.repository }} | ||
|
||
jobs: | ||
build-and-push-prerelease: | ||
runs-on: ubuntu-latest | ||
permissions: | ||
contents: write | ||
packages: write | ||
|
||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v3 | ||
|
||
- name: Get latest pre-release info | ||
id: prerelease | ||
run: | | ||
PRERELEASE_INFO=$(curl -s "https://api.github.com/repos/TNTwise/REAL-Video-Enhancer/releases" | jq -r '[.[] | select(.prerelease == true)] | sort_by(.published_at) | reverse | .[0]') | ||
echo "PRERELEASE_TAG=$(echo $PRERELEASE_INFO | jq -r .tag_name)" >> $GITHUB_OUTPUT | ||
echo "PRERELEASE_DATE=$(echo $PRERELEASE_INFO | jq -r .published_at)" >> $GITHUB_OUTPUT | ||
- name: Check for updates | ||
id: check | ||
run: | | ||
if [ ! -f .last_prerelease_build ] || [ "$(cat .last_prerelease_build)" != "${{ steps.prerelease.outputs.PRERELEASE_TAG }}_${{ steps.prerelease.outputs.PRERELEASE_DATE }}" ]; then | ||
echo "update=true" >> $GITHUB_OUTPUT | ||
else | ||
echo "update=false" >> $GITHUB_OUTPUT | ||
fi | ||
- name: Prepare Docker metadata | ||
id: meta | ||
run: | | ||
echo "IMAGE_ID=$(echo ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} | tr '[A-Z]' '[a-z]')" >> $GITHUB_OUTPUT | ||
- name: Log in to the Container registry | ||
if: steps.check.outputs.update == 'true' | ||
uses: docker/login-action@v2 | ||
with: | ||
registry: ${{ env.REGISTRY }} | ||
username: ${{ github.actor }} | ||
password: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- name: Build and push Docker image | ||
if: steps.check.outputs.update == 'true' | ||
uses: docker/build-push-action@v4 | ||
with: | ||
context: . | ||
push: true | ||
tags: ${{ steps.meta.outputs.IMAGE_ID }}:pre-release | ||
file: ./dockerfile.pre | ||
|
||
- name: Update last build info | ||
if: steps.check.outputs.update == 'true' | ||
run: | | ||
echo "${{ steps.prerelease.outputs.PRERELEASE_TAG }}_${{ steps.prerelease.outputs.PRERELEASE_DATE }}" > .last_prerelease_build | ||
git config user.name github-actions | ||
git config user.email [email protected] | ||
git add .last_prerelease_build | ||
git commit -m "Update last pre-release build info" | ||
git push |
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,69 @@ | ||
name: Build and Push Release Docker Image | ||
|
||
on: | ||
schedule: | ||
- cron: '0 0 * * *' # Run daily at midnight UTC | ||
workflow_dispatch: # Allow manual triggering | ||
|
||
env: | ||
REGISTRY: ghcr.io | ||
IMAGE_NAME: ${{ github.repository }} | ||
|
||
jobs: | ||
build-and-push-release: | ||
runs-on: ubuntu-latest | ||
permissions: | ||
contents: write | ||
packages: write | ||
|
||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v3 | ||
|
||
- name: Get latest release info | ||
id: release | ||
run: | | ||
RELEASE_INFO=$(curl -s https://api.github.com/repos/TNTwise/REAL-Video-Enhancer/releases/latest) | ||
echo "RELEASE_TAG=$(echo $RELEASE_INFO | jq -r .tag_name)" >> $GITHUB_OUTPUT | ||
echo "RELEASE_DATE=$(echo $RELEASE_INFO | jq -r .published_at)" >> $GITHUB_OUTPUT | ||
- name: Check for updates | ||
id: check | ||
run: | | ||
if [ ! -f .last_build ] || [ "$(cat .last_build)" != "${{ steps.release.outputs.RELEASE_TAG }}_${{ steps.release.outputs.RELEASE_DATE }}" ]; then | ||
echo "update=true" >> $GITHUB_OUTPUT | ||
else | ||
echo "update=false" >> $GITHUB_OUTPUT | ||
fi | ||
- name: Prepare Docker metadata | ||
id: meta | ||
run: | | ||
echo "IMAGE_ID=$(echo ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} | tr '[A-Z]' '[a-z]')" >> $GITHUB_OUTPUT | ||
- name: Log in to the Container registry | ||
if: steps.check.outputs.update == 'true' | ||
uses: docker/login-action@v2 | ||
with: | ||
registry: ${{ env.REGISTRY }} | ||
username: ${{ github.actor }} | ||
password: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- name: Build and push Docker image | ||
if: steps.check.outputs.update == 'true' | ||
uses: docker/build-push-action@v4 | ||
with: | ||
context: . | ||
push: true | ||
tags: ${{ steps.meta.outputs.IMAGE_ID }}:latest | ||
file: ./dockerfile | ||
|
||
- name: Update last build info | ||
if: steps.check.outputs.update == 'true' | ||
run: | | ||
echo "${{ steps.release.outputs.RELEASE_TAG }}_${{ steps.release.outputs.RELEASE_DATE }}" > .last_build | ||
git config user.name github-actions | ||
git config user.email [email protected] | ||
git add .last_build | ||
git commit -m "Update last build info" | ||
git push |
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,3 @@ | ||
/.github/workflows/latest_release-local.yml | ||
/.github/workflows/latest_pre-release-local.yml | ||
/.github/workflows/latest_development-local.yml |
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 @@ | ||
|
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 @@ | ||
|
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,94 @@ | ||
# Stage 1: Python base image for opencv and tqdm modules | ||
FROM python:3.11 AS builder | ||
# Install pip for Python 3.11 and required Python packages (numpy, opencv, tqdm, etc.) | ||
RUN python3 -m pip install --no-warn-script-location numpy | ||
RUN python3 -m pip install --user --no-warn-script-location opencv-python tqdm | ||
|
||
# Stage 2: Download and extract REAL-Video-Enhancer | ||
FROM ubuntu:20.04 AS downloader | ||
RUN apt-get update && apt-get install -y curl unzip | ||
WORKDIR /tmp | ||
RUN DOWNLOAD_URL=$(curl -s https://api.github.com/repos/TNTwise/REAL-Video-Enhancer/releases/latest | grep "browser_download_url.*Linux.zip" | cut -d '"' -f 4) && \ | ||
curl -L "$DOWNLOAD_URL" -o REAL-Video-Enhancer-Linux.zip && \ | ||
unzip REAL-Video-Enhancer-Linux.zip && \ | ||
rm REAL-Video-Enhancer-Linux.zip | ||
|
||
# Stage 3: Final Image | ||
FROM ich777/novnc-baseimage | ||
# Basic environment setups | ||
ENV DEBIAN_FRONTEND=noninteractive | ||
ENV LANG=C.UTF-8 | ||
ENV LC_ALL=C.UTF-8 | ||
ENV DATA_DIR=/app | ||
ENV CUSTOM_RES_W=1920 | ||
ENV CUSTOM_RES_H=1080 | ||
ENV CUSTOM_DEPTH=24 | ||
ENV NOVNC_PORT=6080 | ||
ENV RFB_PORT=5900 | ||
ENV TURBOVNC_PARAMS="-securitytypes none" | ||
ENV UMASK=000 | ||
ENV UID=99 | ||
ENV GID=100 | ||
ENV DATA_PERM=770 | ||
ENV USER="realvideoenhancer" | ||
ENV QT_LOGGING_RULES="*.debug=false;qt.*.debug=false" | ||
|
||
# Install basic system dependencies (no Python!) | ||
RUN apt-get update && apt-get install -y \ | ||
libgl1 \ | ||
libglib2.0-0 \ | ||
libxcb-xinerama0 \ | ||
libxkbcommon-x11-0 \ | ||
libdbus-1-3 \ | ||
libxcb-icccm4 \ | ||
libxcb-image0 \ | ||
libxcb-keysyms1 \ | ||
libxcb-randr0 \ | ||
libxcb-render-util0 \ | ||
libxcb-shape0 \ | ||
libxcb-xfixes0 \ | ||
libegl1 \ | ||
libopengl0 \ | ||
libglx0 \ | ||
libglu1-mesa \ | ||
libxcb-cursor0 \ | ||
libxcb1 \ | ||
libx11-xcb1 \ | ||
libxcb-glx0 \ | ||
libxcb-util1 \ | ||
qtbase5-dev \ | ||
qtchooser \ | ||
qt5-qmake \ | ||
qtbase5-dev-tools \ | ||
libqt5gui5 \ | ||
libqt5core5a \ | ||
libqt5dbus5 \ | ||
libqt5network5 \ | ||
libqt5widgets5 \ | ||
pciutils \ | ||
zenity \ | ||
&& rm -rf /var/lib/apt/lists/* | ||
|
||
# Set up the user | ||
RUN useradd -d ${DATA_DIR} -s /bin/bash ${USER} && \ | ||
mkdir -p ${DATA_DIR} /data /config && \ | ||
chown -R ${USER}:${USER} ${DATA_DIR} /data /config && \ | ||
ln -s /config/settings.txt /app/settings.txt | ||
|
||
WORKDIR ${DATA_DIR} | ||
|
||
# Copy Python packages from builder stage | ||
COPY --from=builder /root/.local ${DATA_DIR}/.local | ||
|
||
# Copy REAL-Video-Enhancer bin folder from downloader stage | ||
COPY --from=downloader /tmp/bin ${DATA_DIR}/bin | ||
|
||
# Setup scripts | ||
COPY scripts/ /opt/scripts/ | ||
RUN chmod -R 770 /opt/scripts/ | ||
|
||
# Expose noVNC port | ||
EXPOSE 6080 | ||
|
||
# Final entry point | ||
ENTRYPOINT ["/opt/scripts/start.sh"] |
Oops, something went wrong.