From e850cf0a43e0b3ba8d90aa71549ada026bb07efb Mon Sep 17 00:00:00 2001 From: loukaniko85 <87979686+loukaniko85@users.noreply.github.com> Date: Thu, 12 Feb 2026 09:27:59 +1100 Subject: [PATCH 1/4] Create docker-build.yml --- .github/workflows/docker-build.yml | 153 +++++++++++++++++++++++++++++ 1 file changed, 153 insertions(+) create mode 100644 .github/workflows/docker-build.yml diff --git a/.github/workflows/docker-build.yml b/.github/workflows/docker-build.yml new file mode 100644 index 0000000..5496006 --- /dev/null +++ b/.github/workflows/docker-build.yml @@ -0,0 +1,153 @@ +name: Build and Push Docker Images + +on: + push: + branches: + - main + tags: + - "v*" + pull_request: + branches: + - main + workflow_dispatch: + +env: + REGISTRY: ghcr.io + IMAGE_NAME: ${{ github.repository }} + +jobs: + build-gpu: + name: Build GPU (CUDA) Image + runs-on: ubuntu-latest + permissions: + contents: read + packages: write + + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + + - name: Log in to GitHub Container Registry + if: github.event_name != 'pull_request' + uses: docker/login-action@v3 + with: + registry: ${{ env.REGISTRY }} + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: Extract metadata (tags, labels) + id: meta + uses: docker/metadata-action@v5 + with: + images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} + tags: | + type=ref,event=branch,suffix=-gpu + type=semver,pattern={{version}},suffix=-gpu + type=semver,pattern={{major}}.{{minor}},suffix=-gpu + type=raw,value=latest-gpu,enable={{is_default_branch}} + type=sha,suffix=-gpu + + - name: Build and push GPU image + uses: docker/build-push-action@v6 + with: + context: . + file: Dockerfile.gpu + push: ${{ github.event_name != 'pull_request' }} + tags: ${{ steps.meta.outputs.tags }} + labels: ${{ steps.meta.outputs.labels }} + cache-from: type=gha + cache-to: type=gha,mode=max + + build-cpu: + name: Build CPU Image + runs-on: ubuntu-latest + permissions: + contents: read + packages: write + + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + + - name: Log in to GitHub Container Registry + if: github.event_name != 'pull_request' + uses: docker/login-action@v3 + with: + registry: ${{ env.REGISTRY }} + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: Extract metadata (tags, labels) + id: meta + uses: docker/metadata-action@v5 + with: + images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} + tags: | + type=ref,event=branch,suffix=-cpu + type=semver,pattern={{version}},suffix=-cpu + type=semver,pattern={{major}}.{{minor}},suffix=-cpu + type=raw,value=latest-cpu,enable={{is_default_branch}} + type=sha,suffix=-cpu + + - name: Build and push CPU image + uses: docker/build-push-action@v6 + with: + context: . + file: Dockerfile.cpu + push: ${{ github.event_name != 'pull_request' }} + tags: ${{ steps.meta.outputs.tags }} + labels: ${{ steps.meta.outputs.labels }} + cache-from: type=gha + cache-to: type=gha,mode=max + + build-rocm: + name: Build GPU (ROCm) Image + runs-on: ubuntu-latest + permissions: + contents: read + packages: write + + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + + - name: Log in to GitHub Container Registry + if: github.event_name != 'pull_request' + uses: docker/login-action@v3 + with: + registry: ${{ env.REGISTRY }} + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: Extract metadata (tags, labels) + id: meta + uses: docker/metadata-action@v5 + with: + images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} + tags: | + type=ref,event=branch,suffix=-rocm + type=semver,pattern={{version}},suffix=-rocm + type=semver,pattern={{major}}.{{minor}},suffix=-rocm + type=raw,value=latest-rocm,enable={{is_default_branch}} + type=sha,suffix=-rocm + + - name: Build and push ROCm image + uses: docker/build-push-action@v6 + with: + context: . + file: Dockerfile.gpu-rocm + push: ${{ github.event_name != 'pull_request' }} + tags: ${{ steps.meta.outputs.tags }} + labels: ${{ steps.meta.outputs.labels }} + cache-from: type=gha + cache-to: type=gha,mode=max + From d2636c2f95d7b4f434db56f0021beafa75e51c5c Mon Sep 17 00:00:00 2001 From: loukaniko85 <87979686+loukaniko85@users.noreply.github.com> Date: Fri, 13 Feb 2026 11:41:20 +1100 Subject: [PATCH 2/4] Update requirements.txt --- requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements.txt b/requirements.txt index 6618feb..218b104 100644 --- a/requirements.txt +++ b/requirements.txt @@ -20,7 +20,7 @@ psutil==5.9.0 # PyTorch - Install separately with CUDA support: # On Windows/Linux: -# pip3 install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu124 +# pip3 install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu128 # On macOS: # pip3 install torch torchvision torchaudio From ef1a198424662ee7d6edd158d11a30aa87e0f336 Mon Sep 17 00:00:00 2001 From: loukaniko85 <87979686+loukaniko85@users.noreply.github.com> Date: Fri, 13 Feb 2026 11:41:34 +1100 Subject: [PATCH 3/4] Update Dockerfile.gpu --- Dockerfile.gpu | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Dockerfile.gpu b/Dockerfile.gpu index 3ef3835..80c4912 100644 --- a/Dockerfile.gpu +++ b/Dockerfile.gpu @@ -29,7 +29,7 @@ RUN python3 -m venv /app/venv ENV PATH="/app/venv/bin:$PATH" # Install PyTorch with CUDA support and other dependencies -RUN pip3 install --no-cache-dir torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu124 && \ +RUN pip3 install --no-cache-dir torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu128 && \ pip3 install --no-cache-dir -r requirements.txt # Copy project files @@ -44,4 +44,4 @@ ENV PYTHONUNBUFFERED=1 \ EXPOSE 5005 # Run FastAPI server with uvicorn -CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "5005", "--workers", "1"] \ No newline at end of file +CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "5005", "--workers", "1"] From 9dd87621ad7da6041ffdebfe84e479577dd2a697 Mon Sep 17 00:00:00 2001 From: loukaniko85 <87979686+loukaniko85@users.noreply.github.com> Date: Fri, 13 Feb 2026 11:43:43 +1100 Subject: [PATCH 4/4] Update docker-build.yml --- .github/workflows/docker-build.yml | 127 +++++------------------------ 1 file changed, 21 insertions(+), 106 deletions(-) diff --git a/.github/workflows/docker-build.yml b/.github/workflows/docker-build.yml index 5496006..755c129 100644 --- a/.github/workflows/docker-build.yml +++ b/.github/workflows/docker-build.yml @@ -2,13 +2,10 @@ name: Build and Push Docker Images on: push: - branches: - - main - tags: - - "v*" + branches: [main] + tags: ["v*"] pull_request: - branches: - - main + branches: [main] workflow_dispatch: env: @@ -16,12 +13,21 @@ env: IMAGE_NAME: ${{ github.repository }} jobs: - build-gpu: - name: Build GPU (CUDA) Image + build: + name: Build ${{ matrix.variant }} Image runs-on: ubuntu-latest permissions: contents: read packages: write + + strategy: + fail-fast: false + matrix: + include: + - variant: gpu + file: Dockerfile.gpu + - variant: cpu + file: Dockerfile.cpu steps: - name: Checkout repository @@ -44,110 +50,19 @@ jobs: with: images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} tags: | - type=ref,event=branch,suffix=-gpu - type=semver,pattern={{version}},suffix=-gpu - type=semver,pattern={{major}}.{{minor}},suffix=-gpu - type=raw,value=latest-gpu,enable={{is_default_branch}} - type=sha,suffix=-gpu + type=ref,event=branch,suffix=-${{ matrix.variant }} + type=semver,pattern={{version}},suffix=-${{ matrix.variant }} + type=semver,pattern={{major}}.{{minor}},suffix=-${{ matrix.variant }} + type=raw,value=latest-${{ matrix.variant }},enable={{is_default_branch}} + type=sha,suffix=-${{ matrix.variant }} - - name: Build and push GPU image + - name: Build and push uses: docker/build-push-action@v6 with: context: . - file: Dockerfile.gpu + file: ${{ matrix.file }} push: ${{ github.event_name != 'pull_request' }} tags: ${{ steps.meta.outputs.tags }} labels: ${{ steps.meta.outputs.labels }} cache-from: type=gha cache-to: type=gha,mode=max - - build-cpu: - name: Build CPU Image - runs-on: ubuntu-latest - permissions: - contents: read - packages: write - - steps: - - name: Checkout repository - uses: actions/checkout@v4 - - - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v3 - - - name: Log in to GitHub Container Registry - if: github.event_name != 'pull_request' - uses: docker/login-action@v3 - with: - registry: ${{ env.REGISTRY }} - username: ${{ github.actor }} - password: ${{ secrets.GITHUB_TOKEN }} - - - name: Extract metadata (tags, labels) - id: meta - uses: docker/metadata-action@v5 - with: - images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} - tags: | - type=ref,event=branch,suffix=-cpu - type=semver,pattern={{version}},suffix=-cpu - type=semver,pattern={{major}}.{{minor}},suffix=-cpu - type=raw,value=latest-cpu,enable={{is_default_branch}} - type=sha,suffix=-cpu - - - name: Build and push CPU image - uses: docker/build-push-action@v6 - with: - context: . - file: Dockerfile.cpu - push: ${{ github.event_name != 'pull_request' }} - tags: ${{ steps.meta.outputs.tags }} - labels: ${{ steps.meta.outputs.labels }} - cache-from: type=gha - cache-to: type=gha,mode=max - - build-rocm: - name: Build GPU (ROCm) Image - runs-on: ubuntu-latest - permissions: - contents: read - packages: write - - steps: - - name: Checkout repository - uses: actions/checkout@v4 - - - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v3 - - - name: Log in to GitHub Container Registry - if: github.event_name != 'pull_request' - uses: docker/login-action@v3 - with: - registry: ${{ env.REGISTRY }} - username: ${{ github.actor }} - password: ${{ secrets.GITHUB_TOKEN }} - - - name: Extract metadata (tags, labels) - id: meta - uses: docker/metadata-action@v5 - with: - images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} - tags: | - type=ref,event=branch,suffix=-rocm - type=semver,pattern={{version}},suffix=-rocm - type=semver,pattern={{major}}.{{minor}},suffix=-rocm - type=raw,value=latest-rocm,enable={{is_default_branch}} - type=sha,suffix=-rocm - - - name: Build and push ROCm image - uses: docker/build-push-action@v6 - with: - context: . - file: Dockerfile.gpu-rocm - push: ${{ github.event_name != 'pull_request' }} - tags: ${{ steps.meta.outputs.tags }} - labels: ${{ steps.meta.outputs.labels }} - cache-from: type=gha - cache-to: type=gha,mode=max -