Merge pull request #226 from BWagener/feature/container-image-publish

Feature/container image publish
This commit is contained in:
Vadim Rangnau authored and GitHub committed 2025-02-13 22:40:00 +01:00
commit d73c91bc12
6 files changed
+96 -36

No files matched your search

@@ -0,0 +1,84 @@
name: Build container image
on:
push:
workflow_dispatch:
env:
GITHUB_REPOSITORY_NAME_PART_SLUG_URL: '' # filled by rlespinasse/github-slug-action@v5
REGISTRY_USER: ${{ github.actor }}
REGISTRY_PASSWORD: ${{ github.token }}
jobs:
push-ghcr:
name: Build and push image
runs-on: ubuntu-22.04
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Inject enhanced GitHub environment variables
uses: rlespinasse/github-slug-action@v5 # https://github.com/rlespinasse/github-slug-action
- name: lowercase IMAGE_REGISTRY
run: |
echo "IMAGE_REGISTRY=ghcr.io/${GITHUB_REPOSITORY_OWNER_PART_SLUG@L}" >> "${GITHUB_ENV}"
- name: Clear space
run: |
df -h /
sudo rm -rf \
"$AGENT_TOOLSDIRECTORY" \
/opt/google/chrome \
/opt/microsoft/msedge \
/opt/microsoft/powershell \
/opt/pipx \
/usr/lib/mono \
/usr/local/julia* \
/usr/local/lib/android \
/usr/local/lib/node_modules \
/usr/local/share/chromium \
/usr/local/share/powershell \
/usr/share/dotnet \
/usr/share/swift
df -h /
# Determine tags using Docker Metadata action https://github.com/docker/metadata-action
- name: Docker Metadata
id: docker-metadata
uses: docker/metadata-action@v5
with:
tags: |
type=raw,value=latest,enable=${{ github.ref == format('refs/heads/{0}', 'main') }}
type=edge
type=sha
type=ref,event=branch
type=ref,event=pr
type=schedule
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
type=semver,pattern={{major}}
# Build image using Buildah action https://github.com/redhat-actions/buildah-build
- name: Build Image
id: build_image
uses: redhat-actions/buildah-build@v2
with:
image: ${{ env.GITHUB_REPOSITORY_NAME_PART_SLUG_URL }}
tags: ${{ steps.docker-metadata.outputs.tags }}
containerfiles: |
./Dockerfile
oci: true
layers: true
labels: |
${{ steps.docker-metadata.outputs.labels }}
# Push the image to GHCR (Image Registry) https://github.com/redhat-actions/push-to-registry
- name: Push To Registry
uses: redhat-actions/push-to-registry@v2
id: push
with:
image: ${{ steps.build_image.outputs.image }}
tags: ${{ steps.build_image.outputs.tags }}
registry: ${{ env.IMAGE_REGISTRY }}
username: ${{ env.REGISTRY_USER }}
password: ${{ env.REGISTRY_PASSWORD }}
extra-args: |
--disable-content-trust
- name: Echo outputs
run: |
echo "${{ toJSON(steps.push.outputs) }}"
-28
View File
@@ -1,28 +0,0 @@
name: docker
on:
push:
branches:
- 'main'
jobs:
docker:
environment: docker
runs-on: ubuntu-latest
steps:
- name: Delete huge unnecessary tools folder
run: rm -rf /opt/hostedtoolcache
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Build and push
uses: docker/build-push-action@v6
with:
push: true
tags: rakuri255/ultrasinger:latest
+5 -2
View File
@@ -2,11 +2,12 @@ FROM nvidia/cuda:12.6.3-runtime-ubuntu22.04
# note: the python3-pip package contains Python 3.10 on Ubuntu 22.04
RUN apt-get update \
&& apt-get install git python3-pip python3.10-venv ffmpeg curl -y \
&& apt-get install git python3-pip python3.10-venv ffmpeg -y \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*
COPY . /app/UltraSinger
# copy only the requirements file to leverage container image build cache
COPY ./requirements.txt /app/UltraSinger/requirements.txt
WORKDIR /app/UltraSinger
# no need to run as root
@@ -23,5 +24,7 @@ RUN pip install --no-cache-dir -r requirements.txt \
&& pip install --no-cache-dir torch==2.3.0 torchvision==0.18.0 torchaudio==2.3.0 --index-url https://download.pytorch.org/whl/cu121 \
&& pip install --no-cache-dir tensorflow[and-cuda]==2.16.1
# copy sources late to allow for caching of layers which contain all the dependencies
COPY . /app/UltraSinger
WORKDIR /app/UltraSinger/src
CMD ["bash" ]
-1
View File
@@ -296,7 +296,6 @@ TensorFlow dropped GPU support for Windows for versions >2.10 as you can see in
For now UltraSinger runs the latest version available that still supports GPUs on windows.
For running later versions of TensorFlow on windows while still taking advantage of GPU support the suggested solution is to [run UltraSinger in a container](container/README.md).
#### Crashes due to low VRAM
If something crashes because of low VRAM then use a smaller model.
+6 -4
View File
@@ -7,9 +7,11 @@
```commandline
git clone https://github.com/rakuri255/UltraSinger.git
```
1. build the container image
```commandline
1. build or pull the container image
```bash
podman build -t ultrasinger .
# or
podman pull ghcr.io/rakuri255/ultrasinger:<version> # replace <version> with the desired version or 'latest'
```
1. run the container (note that the first time you run the container models will be downloaded which may take a while)
1. PowerShell:
@@ -20,7 +22,7 @@
--device nvidia.com/gpu=all `
-v $env:USERPROFILE\.cache:/app/UltraSinger/src/.cache `
-v <desired-output-folder>:/app/UltraSinger/src/output `
ultrasinger `
ghcr.io/rakuri255/ultrasinger `
python3 UltraSinger.py -i <refer to top-level README.md>
# explanation:
@@ -29,7 +31,7 @@
--device nvidia.com/gpu=all ` # optional, enables GPU acceleration if available, requires step 1.ii
-v $env:USERPROFILE\.cache:/app/UltraSinger/src/.cache ` # cache directory for models
-v <desired-output-folder>:/app/UltraSinger/src/output ` # output directory
ultrasinger ` # container image name, we built this in step 3
ghcr.io/rakuri255/ultrasinger ` # latest container image, set to 'ultrasinger' to use the locally built image
python3 UltraSinger.py -i <refer to top-level README.md> # run UltraSinger, refer to top-level README.md for all options
```
1. Bash:
+1 -1
View File
@@ -648,7 +648,7 @@ wrapt==1.16.0
# via tensorflow
yarl==1.9.4
# via aiohttp
yt-dlp==2025.1.26
yt-dlp==2025.01.26
# via -r requirements.in
# The following packages are considered to be unsafe in a requirements file: