mirror of
https://github.com/BillyOutlast/rocm-automated.git
synced 2026-02-04 03:51:19 +01:00
Some checks failed
Daily ROCm Container Build (Pure Shell) / prepare (push) Successful in 15s
Daily ROCm Container Build (Pure Shell) / build-base-images (map[context:. dockerfile:Dockerfile.comfyui-rocm7.1 name:comfyui-rocm7.1]) (push) Failing after 0s
Daily ROCm Container Build (Pure Shell) / build-stable-diffusion-variants (gfx1030) (push) Failing after 1s
Daily ROCm Container Build (Pure Shell) / build-stable-diffusion-variants (gfx1100) (push) Failing after 2s
Daily ROCm Container Build (Pure Shell) / build-stable-diffusion-variants (gfx1101) (push) Failing after 2s
Daily ROCm Container Build (Pure Shell) / build-stable-diffusion-variants (gfx1150) (push) Failing after 1s
Daily ROCm Container Build (Pure Shell) / build-stable-diffusion-variants (gfx1151) (push) Failing after 2s
Daily ROCm Container Build (Pure Shell) / build-stable-diffusion-variants (gfx1200) (push) Failing after 1s
Daily ROCm Container Build (Pure Shell) / build-stable-diffusion-variants (gfx1201) (push) Failing after 1s
Daily ROCm Container Build (Pure Shell) / build-base-images (map[context:. dockerfile:Dockerfile.stable-diffusion.cpp-rocm7.1 name:stable-diffusion.cpp-rocm7.1]) (push) Failing after 17s
Daily ROCm Container Build (Pure Shell) / test-compose (push) Has been skipped
Daily ROCm Container Build (Pure Shell) / notify (push) Successful in 0s
Daily ROCm Container Build (Pure Shell) / cleanup (push) Failing after 12s
735 lines
29 KiB
YAML
735 lines
29 KiB
YAML
name: Daily ROCm Container Build (Pure Shell)
|
||
|
||
on:
|
||
schedule:
|
||
# Run daily at 02:00 UTC
|
||
- cron: '0 2 * * *'
|
||
workflow_dispatch: # Allow manual triggering
|
||
inputs:
|
||
push_images:
|
||
description: 'Push images to registry'
|
||
required: true
|
||
default: 'true'
|
||
type: boolean
|
||
build_all:
|
||
description: 'Build all variants'
|
||
required: true
|
||
default: 'true'
|
||
type: boolean
|
||
|
||
env:
|
||
REGISTRY: docker.io
|
||
REGISTRY_USER: getterup
|
||
|
||
jobs:
|
||
prepare:
|
||
runs-on: ubuntu-latest
|
||
outputs:
|
||
date: ${{ steps.date.outputs.date }}
|
||
sha_short: ${{ steps.vars.outputs.sha_short }}
|
||
|
||
steps:
|
||
- name: Manual checkout
|
||
run: |
|
||
echo "🔄 Manually cloning repository for prepare job..."
|
||
rm -rf /tmp/repo-prepare
|
||
git clone --depth=1 ${{ github.server_url }}/${{ github.repository }} /tmp/repo-prepare
|
||
cd /tmp/repo-prepare
|
||
if [ "${{ github.event_name }}" != "schedule" ]; then
|
||
git fetch origin ${{ github.sha }}
|
||
git checkout ${{ github.sha }}
|
||
fi
|
||
cp -r . ${{ github.workspace }}
|
||
shell: bash
|
||
|
||
- name: Get current date
|
||
id: date
|
||
run: |
|
||
echo "date=$(date +'%Y-%m-%d')" >> $GITHUB_OUTPUT
|
||
shell: bash
|
||
|
||
- name: Set variables
|
||
id: vars
|
||
run: |
|
||
echo "sha_short=$(echo ${GITHUB_SHA} | cut -c1-7)" >> $GITHUB_OUTPUT
|
||
shell: bash
|
||
|
||
build-base-images:
|
||
runs-on: ubuntu-latest
|
||
needs: prepare
|
||
strategy:
|
||
matrix:
|
||
image:
|
||
- name: comfyui-rocm7.1
|
||
dockerfile: Dockerfile.comfyui-rocm7.1
|
||
context: .
|
||
- name: stable-diffusion.cpp-rocm7.1
|
||
dockerfile: Dockerfile.stable-diffusion.cpp-rocm7.1
|
||
context: .
|
||
|
||
steps:
|
||
- name: Manual checkout
|
||
run: |
|
||
echo "🔄 Manually cloning repository for build-base-images job..."
|
||
rm -rf /tmp/repo-build-base
|
||
git clone --depth=1 ${{ github.server_url }}/${{ github.repository }} /tmp/repo-build-base
|
||
cd /tmp/repo-build-base
|
||
if [ "${{ github.event_name }}" != "schedule" ]; then
|
||
git fetch origin ${{ github.sha }}
|
||
git checkout ${{ github.sha }}
|
||
fi
|
||
cp -r . ${{ github.workspace }}
|
||
shell: bash
|
||
|
||
- name: Install Docker
|
||
run: |
|
||
echo "🐳 Installing Docker..."
|
||
|
||
# Check if Docker is already installed
|
||
if command -v docker &> /dev/null; then
|
||
echo "✅ Docker is already installed"
|
||
docker --version
|
||
else
|
||
echo "📦 Installing Docker..."
|
||
|
||
# Determine if we need sudo or not
|
||
if command -v sudo &> /dev/null && [ "$(id -u)" != "0" ]; then
|
||
SUDO="sudo"
|
||
else
|
||
SUDO=""
|
||
echo "ℹ️ Running as root or sudo not available - using direct commands"
|
||
fi
|
||
|
||
DOCKER_INSTALLED=false
|
||
|
||
# Detect package manager and install Docker accordingly
|
||
if command -v apt-get &> /dev/null; then
|
||
echo "📱 Using apt-get (Debian/Ubuntu)..."
|
||
|
||
# Update package index
|
||
if $SUDO apt-get update -qq; then
|
||
echo "✅ Package index updated"
|
||
else
|
||
echo "⚠️ Failed to update package index"
|
||
fi
|
||
|
||
# Install prerequisites
|
||
if $SUDO apt-get install -y -qq \
|
||
apt-transport-https \
|
||
ca-certificates \
|
||
curl \
|
||
gnupg \
|
||
lsb-release; then
|
||
|
||
# Add Docker GPG key and repo
|
||
if curl -fsSL https://download.docker.com/linux/ubuntu/gpg | $SUDO gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg; then
|
||
echo "deb [arch=amd64 signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable" | $SUDO tee /etc/apt/sources.list.d/docker.list > /dev/null
|
||
|
||
# Install Docker
|
||
if $SUDO apt-get update -qq && $SUDO apt-get install -y -qq docker-ce docker-ce-cli containerd.io; then
|
||
DOCKER_INSTALLED=true
|
||
echo "✅ Docker installed via apt-get"
|
||
else
|
||
echo "⚠️ Docker installation via apt-get failed"
|
||
fi
|
||
else
|
||
echo "⚠️ Failed to add Docker GPG key"
|
||
fi
|
||
else
|
||
echo "⚠️ Failed to install prerequisites"
|
||
fi
|
||
|
||
elif command -v yum &> /dev/null; then
|
||
echo "📱 Using yum (RHEL/CentOS/Fedora)..."
|
||
|
||
# Install Docker from official repo
|
||
if $SUDO yum install -y yum-utils && \
|
||
$SUDO yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo && \
|
||
$SUDO yum install -y docker-ce docker-ce-cli containerd.io; then
|
||
DOCKER_INSTALLED=true
|
||
echo "✅ Docker installed via yum"
|
||
else
|
||
echo "⚠️ Docker installation via yum failed"
|
||
fi
|
||
|
||
elif command -v apk &> /dev/null; then
|
||
echo "📱 Using apk (Alpine Linux)..."
|
||
|
||
# Install Docker
|
||
if $SUDO apk update && $SUDO apk add docker docker-compose; then
|
||
DOCKER_INSTALLED=true
|
||
echo "✅ Docker installed via apk"
|
||
else
|
||
echo "⚠️ Docker installation via apk failed"
|
||
fi
|
||
|
||
else
|
||
echo "⚠️ No supported package manager found - will try binary installation"
|
||
fi
|
||
|
||
# If package manager installation failed, try binary installation
|
||
if [ "$DOCKER_INSTALLED" = "false" ]; then
|
||
echo "📦 Trying binary installation..."
|
||
|
||
# Install Docker from binary
|
||
DOCKER_VERSION="24.0.7"
|
||
echo "📦 Downloading Docker ${DOCKER_VERSION} binaries..."
|
||
|
||
if curl -fsSL https://download.docker.com/linux/static/stable/x86_64/docker-${DOCKER_VERSION}.tgz | tar xz; then
|
||
# Move binaries to PATH
|
||
if [ -d "docker" ]; then
|
||
$SUDO mkdir -p /usr/local/bin
|
||
$SUDO mv docker/* /usr/local/bin/
|
||
$SUDO chmod +x /usr/local/bin/docker*
|
||
rm -rf docker
|
||
|
||
# Add to PATH if not already there
|
||
export PATH="/usr/local/bin:$PATH"
|
||
echo "export PATH=\"/usr/local/bin:$PATH\"" >> ~/.bashrc
|
||
|
||
# Create docker group
|
||
$SUDO groupadd docker 2>/dev/null || true
|
||
|
||
DOCKER_INSTALLED=true
|
||
echo "✅ Docker binaries installed to /usr/local/bin"
|
||
else
|
||
echo "❌ Docker binary extraction failed"
|
||
fi
|
||
else
|
||
echo "❌ Failed to download Docker binaries"
|
||
fi
|
||
fi
|
||
|
||
# Verify Docker installation
|
||
if [ "$DOCKER_INSTALLED" = "true" ]; then
|
||
if command -v docker &> /dev/null; then
|
||
echo "✅ Docker command is available"
|
||
docker --version 2>/dev/null || echo "⚠️ Docker version check failed but command exists"
|
||
else
|
||
echo "❌ Docker command not found after installation"
|
||
DOCKER_INSTALLED=false
|
||
fi
|
||
fi
|
||
|
||
if [ "$DOCKER_INSTALLED" = "false" ]; then
|
||
echo "❌ All Docker installation methods failed"
|
||
exit 1
|
||
fi
|
||
|
||
echo "✅ Docker installation completed successfully"
|
||
fi
|
||
shell: bash
|
||
|
||
- name: Set up Docker Buildx
|
||
run: |
|
||
echo "🐳 Setting up Docker Buildx..."
|
||
|
||
# Ensure Docker binaries are in PATH
|
||
export PATH="/usr/local/bin:$PATH"
|
||
|
||
# Verify Docker client is available
|
||
if ! command -v docker &> /dev/null; then
|
||
echo "❌ Docker command not found in PATH"
|
||
echo "PATH: $PATH"
|
||
exit 1
|
||
fi
|
||
|
||
# Check Docker version to confirm installation
|
||
echo "📋 Docker version:"
|
||
docker --version
|
||
|
||
# Check if Docker daemon is running, start if needed
|
||
if ! docker info &> /dev/null; then
|
||
echo "🔄 Docker daemon not running - attempting to start..."
|
||
|
||
# Try systemctl first (if available)
|
||
if command -v systemctl &> /dev/null; then
|
||
if systemctl is-active --quiet docker; then
|
||
echo "✅ Docker service is already active"
|
||
else
|
||
echo "🔄 Starting Docker service with systemctl..."
|
||
if command -v sudo &> /dev/null && [ "$(id -u)" != "0" ]; then
|
||
sudo systemctl start docker 2>/dev/null || echo "⚠️ systemctl start failed - may need manual start"
|
||
else
|
||
systemctl start docker 2>/dev/null || echo "⚠️ systemctl start failed - may need manual start"
|
||
fi
|
||
fi
|
||
else
|
||
echo "ℹ️ systemctl not available"
|
||
fi
|
||
|
||
# Wait a moment for the daemon to start
|
||
sleep 3
|
||
|
||
# Final check - if still not running, we have an issue
|
||
if ! docker info &> /dev/null; then
|
||
echo "❌ Docker daemon is not running and couldn't be started"
|
||
echo "Debugging information:"
|
||
echo "- Docker binary: $(command -v docker || echo 'NOT FOUND')"
|
||
echo "- Docker version: $(docker --version || echo 'FAILED')"
|
||
echo "- System info: $(uname -a)"
|
||
echo "- Available services: $(systemctl list-units --type=service | grep docker || echo 'No docker services found')"
|
||
exit 1
|
||
fi
|
||
else
|
||
echo "✅ Docker daemon is already running"
|
||
fi
|
||
else
|
||
echo "✅ Docker daemon is already running"
|
||
fi
|
||
|
||
# Show Docker info
|
||
echo "📊 Docker daemon info:"
|
||
docker version --format 'Client: {{.Client.Version}}, Server: {{.Server.Version}}' || docker version
|
||
|
||
# Check if buildx is available
|
||
if ! docker buildx version > /dev/null 2>&1; then
|
||
echo "📦 Installing Docker Buildx..."
|
||
mkdir -p ~/.docker/cli-plugins
|
||
BUILDX_VERSION="v0.12.1"
|
||
wget -q -O ~/.docker/cli-plugins/docker-buildx \
|
||
"https://github.com/docker/buildx/releases/download/${BUILDX_VERSION}/buildx-${BUILDX_VERSION}.linux-amd64"
|
||
chmod +x ~/.docker/cli-plugins/docker-buildx
|
||
else
|
||
echo "✅ Docker Buildx is already available"
|
||
fi
|
||
|
||
# Create and use builder instance
|
||
echo "🏗️ Setting up Buildx builder..."
|
||
docker buildx create --name mybuilder --use --bootstrap 2>/dev/null || {
|
||
echo "ℹ️ Builder creation failed - trying to use existing or default builder"
|
||
docker buildx use default 2>/dev/null || docker buildx use mybuilder 2>/dev/null || echo "⚠️ Using default builder context"
|
||
}
|
||
|
||
# Verify buildx is working
|
||
docker buildx inspect --bootstrap || echo "⚠️ Buildx inspect failed but continuing"
|
||
docker buildx ls
|
||
|
||
echo "✅ Docker Buildx setup completed"
|
||
shell: bash
|
||
|
||
- name: Log in to Docker Hub
|
||
if: github.event_name == 'schedule' || (github.event_name == 'workflow_dispatch' && github.event.inputs.push_images == 'true')
|
||
run: |
|
||
echo "🔐 Logging into Docker Hub..."
|
||
echo "${{ secrets.DOCKER_PASSWORD }}" | docker login ${{ env.REGISTRY }} -u ${{ env.REGISTRY_USER }} --password-stdin
|
||
shell: bash
|
||
|
||
- name: Build and push Docker image
|
||
run: |
|
||
echo "🏗️ Building ${{ matrix.image.name }}..."
|
||
|
||
IMAGE_NAME="${{ env.REGISTRY }}/${{ env.REGISTRY_USER }}/${{ matrix.image.name }}"
|
||
TAGS="${IMAGE_NAME}:latest ${IMAGE_NAME}:${{ needs.prepare.outputs.date }} ${IMAGE_NAME}:${{ needs.prepare.outputs.sha_short }}"
|
||
|
||
# Build the image
|
||
BUILD_ARGS=""
|
||
BUILD_ARGS="$BUILD_ARGS --build-arg BUILD_DATE=${{ needs.prepare.outputs.date }}"
|
||
BUILD_ARGS="$BUILD_ARGS --build-arg VCS_REF=${{ needs.prepare.outputs.sha_short }}"
|
||
|
||
PUSH_FLAG=""
|
||
if [ "${{ github.event_name }}" == "schedule" ] || [ "${{ github.event.inputs.push_images }}" == "true" ]; then
|
||
PUSH_FLAG="--push"
|
||
echo "📤 Will push images to registry"
|
||
else
|
||
PUSH_FLAG="--load"
|
||
echo "💾 Will load images locally only"
|
||
fi
|
||
|
||
docker buildx build \
|
||
--file Dockerfiles/${{ matrix.image.dockerfile }} \
|
||
--platform linux/amd64 \
|
||
$BUILD_ARGS \
|
||
$(for tag in $TAGS; do echo "--tag $tag"; done) \
|
||
$PUSH_FLAG \
|
||
${{ matrix.image.context }}
|
||
|
||
echo "✅ Build completed for ${{ matrix.image.name }}"
|
||
shell: bash
|
||
|
||
build-stable-diffusion-variants:
|
||
runs-on: ubuntu-latest
|
||
needs: prepare
|
||
if: github.event_name == 'schedule' || (github.event_name == 'workflow_dispatch' && github.event.inputs.build_all == 'true')
|
||
strategy:
|
||
matrix:
|
||
gfx_arch:
|
||
- gfx1150 # RDNA 3.5 (Ryzen AI 9 HX 370)
|
||
- gfx1151 # RDNA 3.5 (Strix Point/Ryzen AI Max+ 365)
|
||
- gfx1200 # RDNA 4 (RX 9070 XT)
|
||
- gfx1100 # RDNA 3 (RX 7900 XTX/XT)
|
||
- gfx1101 # RDNA 3 (RX 7800 XT/7700 XT)
|
||
- gfx1030 # RDNA 2 (RX 6000 series)
|
||
- gfx1201 # RDNA 4 (RX 9060 XT/ RX 9070/XT)
|
||
|
||
steps:
|
||
- name: Manual checkout
|
||
run: |
|
||
echo "🔄 Manually cloning repository for GPU variants job..."
|
||
rm -rf /tmp/repo-gpu-variants
|
||
git clone --depth=1 ${{ github.server_url }}/${{ github.repository }} /tmp/repo-gpu-variants
|
||
cd /tmp/repo-gpu-variants
|
||
if [ "${{ github.event_name }}" != "schedule" ]; then
|
||
git fetch origin ${{ github.sha }}
|
||
git checkout ${{ github.sha }}
|
||
fi
|
||
cp -r . ${{ github.workspace }}
|
||
shell: bash
|
||
|
||
- name: Install Docker
|
||
run: |
|
||
echo "🐳 Installing Docker for GPU variants..."
|
||
|
||
# Check if Docker is already installed
|
||
if command -v docker &> /dev/null; then
|
||
echo "✅ Docker is already installed"
|
||
docker --version
|
||
else
|
||
echo "📦 Installing Docker..."
|
||
|
||
# Determine if we need sudo or not
|
||
if command -v sudo &> /dev/null && [ "$(id -u)" != "0" ]; then
|
||
SUDO="sudo"
|
||
else
|
||
SUDO=""
|
||
echo "ℹ️ Running as root or sudo not available - using direct commands"
|
||
fi
|
||
|
||
# Detect package manager and install Docker accordingly
|
||
if command -v apt-get &> /dev/null; then
|
||
echo "📱 Using apt-get (Debian/Ubuntu)..."
|
||
|
||
# Update package index
|
||
$SUDO apt-get update -qq
|
||
|
||
# Install prerequisites
|
||
$SUDO apt-get install -y -qq \
|
||
apt-transport-https \
|
||
ca-certificates \
|
||
curl \
|
||
gnupg \
|
||
lsb-release
|
||
|
||
# Add Docker GPG key
|
||
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | $SUDO gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg
|
||
|
||
# Add Docker repository
|
||
echo "deb [arch=amd64 signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable" | $SUDO tee /etc/apt/sources.list.d/docker.list > /dev/null
|
||
|
||
# Install Docker
|
||
$SUDO apt-get update -qq
|
||
$SUDO apt-get install -y -qq docker-ce docker-ce-cli containerd.io
|
||
|
||
elif command -v yum &> /dev/null; then
|
||
echo "📱 Using yum (RHEL/CentOS/Fedora)..."
|
||
|
||
# Install Docker from official repo
|
||
$SUDO yum install -y yum-utils
|
||
$SUDO yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo
|
||
$SUDO yum install -y docker-ce docker-ce-cli containerd.io
|
||
|
||
elif command -v apk &> /dev/null; then
|
||
echo "📱 Using apk (Alpine Linux)..."
|
||
|
||
# Update package index
|
||
$SUDO apk update
|
||
|
||
# Install Docker
|
||
$SUDO apk add docker docker-compose
|
||
|
||
else
|
||
echo "⚠️ No supported package manager found - trying binary installation..."
|
||
|
||
# Install Docker from binary
|
||
DOCKER_VERSION="24.0.7"
|
||
echo "📦 Downloading Docker ${DOCKER_VERSION} binaries..."
|
||
|
||
# Download and install Docker binaries
|
||
curl -fsSL https://download.docker.com/linux/static/stable/x86_64/docker-${DOCKER_VERSION}.tgz | tar xz
|
||
$SUDO mv docker/* /usr/local/bin/
|
||
rm -rf docker
|
||
|
||
# Create docker group
|
||
$SUDO groupadd docker 2>/dev/null || true
|
||
|
||
echo "✅ Docker binaries installed"
|
||
fi
|
||
|
||
# Start Docker service (if systemctl is available)
|
||
if command -v systemctl &> /dev/null; then
|
||
$SUDO systemctl start docker 2>/dev/null || echo "⚠️ Could not start docker service - may already be running"
|
||
$SUDO systemctl enable docker 2>/dev/null || echo "⚠️ Could not enable docker service"
|
||
else
|
||
echo "ℹ️ systemctl not available - Docker daemon will be started manually if needed"
|
||
fi
|
||
|
||
echo "✅ Docker installation completed"
|
||
docker --version || echo "⚠️ Docker version check failed"
|
||
fi
|
||
shell: bash
|
||
|
||
- name: Set up Docker Buildx
|
||
run: |
|
||
echo "🐳 Setting up Docker Buildx for GPU variant ${{ matrix.gfx_arch }}..."
|
||
|
||
# Ensure Docker binaries are in PATH
|
||
export PATH="/usr/local/bin:$PATH"
|
||
|
||
# Verify Docker client is available
|
||
if ! command -v docker &> /dev/null; then
|
||
echo "❌ Docker command not found in PATH"
|
||
echo "PATH: $PATH"
|
||
exit 1
|
||
fi
|
||
|
||
# Check Docker version to confirm installation
|
||
echo "📋 Docker version:"
|
||
docker --version
|
||
|
||
# Check if Docker daemon is running, start if needed
|
||
if ! docker info &> /dev/null; then
|
||
echo "🔄 Docker daemon not running - attempting to start..."
|
||
|
||
# Try systemctl first (if available)
|
||
if command -v systemctl &> /dev/null; then
|
||
if systemctl is-active --quiet docker; then
|
||
echo "✅ Docker service is already active"
|
||
else
|
||
echo "🔄 Starting Docker service with systemctl..."
|
||
if command -v sudo &> /dev/null && [ "$(id -u)" != "0" ]; then
|
||
sudo systemctl start docker 2>/dev/null || echo "⚠️ systemctl start failed - may need manual start"
|
||
else
|
||
systemctl start docker 2>/dev/null || echo "⚠️ systemctl start failed - may need manual start"
|
||
fi
|
||
fi
|
||
else
|
||
echo "ℹ️ systemctl not available"
|
||
fi
|
||
|
||
# Wait a moment for the daemon to start
|
||
sleep 3
|
||
|
||
# Final check - if still not running, we have an issue
|
||
if ! docker info &> /dev/null; then
|
||
echo "❌ Docker daemon is not running and couldn't be started"
|
||
echo "Debugging information:"
|
||
echo "- Docker binary: $(command -v docker || echo 'NOT FOUND')"
|
||
echo "- Docker version: $(docker --version || echo 'FAILED')"
|
||
echo "- System info: $(uname -a)"
|
||
echo "- Available services: $(systemctl list-units --type=service | grep docker || echo 'No docker services found')"
|
||
exit 1
|
||
fi
|
||
else
|
||
echo "✅ Docker daemon is already running"
|
||
fi
|
||
|
||
# Check if buildx is available
|
||
if ! docker buildx version > /dev/null 2>&1; then
|
||
echo "📦 Installing Docker Buildx..."
|
||
mkdir -p ~/.docker/cli-plugins
|
||
BUILDX_VERSION="v0.12.1"
|
||
wget -q -O ~/.docker/cli-plugins/docker-buildx \
|
||
"https://github.com/docker/buildx/releases/download/${BUILDX_VERSION}/buildx-${BUILDX_VERSION}.linux-amd64"
|
||
chmod +x ~/.docker/cli-plugins/docker-buildx
|
||
else
|
||
echo "✅ Docker Buildx is already available"
|
||
fi
|
||
|
||
# Create and use builder instance
|
||
echo "🏗️ Setting up Buildx builder for ${{ matrix.gfx_arch }}..."
|
||
docker buildx create --name mybuilder-${{ matrix.gfx_arch }} --use --bootstrap 2>/dev/null || {
|
||
echo "ℹ️ Builder creation failed - trying to use existing or default builder"
|
||
docker buildx use default 2>/dev/null || docker buildx use mybuilder-${{ matrix.gfx_arch }} 2>/dev/null || echo "⚠️ Using default builder context"
|
||
}
|
||
|
||
# Verify buildx is working
|
||
docker buildx inspect --bootstrap || echo "⚠️ Buildx inspect failed but continuing"
|
||
docker buildx ls
|
||
|
||
echo "✅ Docker Buildx setup completed for ${{ matrix.gfx_arch }}"
|
||
shell: bash
|
||
|
||
- name: Log in to Docker Hub
|
||
if: github.event_name == 'schedule' || (github.event_name == 'workflow_dispatch' && github.event.inputs.push_images == 'true')
|
||
run: |
|
||
echo "🔐 Logging into Docker Hub for ${{ matrix.gfx_arch }}..."
|
||
echo "${{ secrets.DOCKER_PASSWORD }}" | docker login ${{ env.REGISTRY }} -u ${{ env.REGISTRY_USER }} --password-stdin
|
||
shell: bash
|
||
|
||
- name: Build and push GPU variant image
|
||
run: |
|
||
echo "🏗️ Building GPU variant for ${{ matrix.gfx_arch }}..."
|
||
|
||
IMAGE_NAME="${{ env.REGISTRY }}/${{ env.REGISTRY_USER }}/stable-diffusion-cpp-${{ matrix.gfx_arch }}"
|
||
TAGS="${IMAGE_NAME}:latest ${IMAGE_NAME}:${{ needs.prepare.outputs.date }} ${IMAGE_NAME}:${{ needs.prepare.outputs.sha_short }}"
|
||
|
||
# Build the GPU-specific image
|
||
BUILD_ARGS=""
|
||
BUILD_ARGS="$BUILD_ARGS --build-arg GFX_ARCH=${{ matrix.gfx_arch }}"
|
||
BUILD_ARGS="$BUILD_ARGS --build-arg BUILD_DATE=${{ needs.prepare.outputs.date }}"
|
||
BUILD_ARGS="$BUILD_ARGS --build-arg VCS_REF=${{ needs.prepare.outputs.sha_short }}"
|
||
|
||
PUSH_FLAG=""
|
||
if [ "${{ github.event_name }}" == "schedule" ] || [ "${{ github.event.inputs.push_images }}" == "true" ]; then
|
||
PUSH_FLAG="--push"
|
||
echo "📤 Will push ${{ matrix.gfx_arch }} variant to registry"
|
||
else
|
||
PUSH_FLAG="--load"
|
||
echo "💾 Will load ${{ matrix.gfx_arch }} variant locally only"
|
||
fi
|
||
|
||
docker buildx build \
|
||
--file Dockerfiles/Dockerfile.stable-diffusion.cpp-rocm7.1 \
|
||
--platform linux/amd64 \
|
||
$BUILD_ARGS \
|
||
$(for tag in $TAGS; do echo "--tag $tag"; done) \
|
||
$PUSH_FLAG \
|
||
.
|
||
|
||
echo "✅ Build completed for ${{ matrix.gfx_arch }} variant"
|
||
shell: bash
|
||
|
||
test-compose:
|
||
runs-on: ubuntu-latest
|
||
needs: [prepare, build-base-images]
|
||
if: github.event_name == 'schedule' || github.event_name == 'workflow_dispatch'
|
||
|
||
steps:
|
||
- name: Manual checkout
|
||
run: |
|
||
echo "🔄 Manually cloning repository for test-compose job..."
|
||
rm -rf /tmp/repo-test-compose
|
||
git clone --depth=1 ${{ github.server_url }}/${{ github.repository }} /tmp/repo-test-compose
|
||
cd /tmp/repo-test-compose
|
||
if [ "${{ github.event_name }}" != "schedule" ]; then
|
||
git fetch origin ${{ github.sha }}
|
||
git checkout ${{ github.sha }}
|
||
fi
|
||
cp -r . ${{ github.workspace }}
|
||
shell: bash
|
||
|
||
- name: Create test directories
|
||
run: |
|
||
echo "📁 Creating test directories..."
|
||
mkdir -p User-Directories/open-webui
|
||
mkdir -p User-Directories/ollama
|
||
mkdir -p User-Directories/comfyui
|
||
echo "✅ Test directories created"
|
||
shell: bash
|
||
|
||
- name: Install Docker Compose
|
||
run: |
|
||
echo "🐳 Installing Docker Compose..."
|
||
|
||
if ! command -v docker-compose &> /dev/null; then
|
||
echo "Installing docker-compose..."
|
||
sudo curl -L "https://github.com/docker/compose/releases/latest/download/docker-compose-$(uname -s)-$(uname -m)" \
|
||
-o /usr/local/bin/docker-compose
|
||
sudo chmod +x /usr/local/bin/docker-compose
|
||
fi
|
||
|
||
docker-compose --version
|
||
shell: bash
|
||
|
||
- name: Test docker-compose configuration
|
||
run: |
|
||
echo "📋 Testing Docker Compose configuration..."
|
||
|
||
# Validate compose file
|
||
docker-compose config --quiet
|
||
echo "✅ Docker Compose configuration is valid"
|
||
|
||
# Test services definition
|
||
docker-compose config --services
|
||
echo "✅ Services configuration verified"
|
||
shell: bash
|
||
|
||
- name: Test image availability
|
||
run: |
|
||
echo "📋 Testing image availability..."
|
||
|
||
# Check if images exist in registry (without pulling)
|
||
IMAGES=(
|
||
"${{ env.REGISTRY }}/${{ env.REGISTRY_USER }}/comfyui-rocm7.1:latest"
|
||
"${{ env.REGISTRY }}/${{ env.REGISTRY_USER }}/stable-diffusion.cpp-rocm7.1:latest"
|
||
)
|
||
|
||
for image in "${IMAGES[@]}"; do
|
||
echo "Checking $image..."
|
||
if docker manifest inspect "$image" >/dev/null 2>&1; then
|
||
echo "✅ $image is available"
|
||
else
|
||
echo "⚠️ $image may not be available yet"
|
||
fi
|
||
done
|
||
|
||
echo "✅ Image availability check completed"
|
||
shell: bash
|
||
|
||
notify:
|
||
runs-on: ubuntu-latest
|
||
needs: [prepare, build-base-images, build-stable-diffusion-variants, test-compose]
|
||
if: always() && (github.event_name == 'schedule')
|
||
|
||
steps:
|
||
- name: Build summary
|
||
run: |
|
||
echo "📊 Daily Build Summary - ${{ needs.prepare.outputs.date }}"
|
||
echo "=================================="
|
||
echo ""
|
||
echo "🔧 Job Results:"
|
||
echo "- Prepare: ${{ needs.prepare.result }}"
|
||
echo "- Base Images: ${{ needs.build-base-images.result }}"
|
||
echo "- GPU Variants: ${{ needs.build-stable-diffusion-variants.result }}"
|
||
echo "- Compose Test: ${{ needs.test-compose.result }}"
|
||
echo ""
|
||
|
||
SUCCESS_COUNT=0
|
||
TOTAL_COUNT=4
|
||
|
||
[ "${{ needs.prepare.result }}" == "success" ] && SUCCESS_COUNT=$((SUCCESS_COUNT + 1))
|
||
[ "${{ needs.build-base-images.result }}" == "success" ] && SUCCESS_COUNT=$((SUCCESS_COUNT + 1))
|
||
[ "${{ needs.build-stable-diffusion-variants.result }}" == "success" ] && SUCCESS_COUNT=$((SUCCESS_COUNT + 1))
|
||
[ "${{ needs.test-compose.result }}" == "success" ] && SUCCESS_COUNT=$((SUCCESS_COUNT + 1))
|
||
|
||
echo "📈 Success Rate: $SUCCESS_COUNT/$TOTAL_COUNT jobs completed successfully"
|
||
|
||
if [ "$SUCCESS_COUNT" -eq "$TOTAL_COUNT" ]; then
|
||
echo "🎉 All builds completed successfully!"
|
||
echo "🐳 Images pushed to ${{ env.REGISTRY }}/${{ env.REGISTRY_USER }}/"
|
||
echo "📋 Docker Compose configuration validated"
|
||
echo "🏗️ Built images:"
|
||
echo " - comfyui-rocm7.1:${{ needs.prepare.outputs.date }}"
|
||
echo " - stable-diffusion.cpp-rocm7.1:${{ needs.prepare.outputs.date }}"
|
||
echo " - 7 GPU-specific variants"
|
||
elif [ "$SUCCESS_COUNT" -gt 0 ]; then
|
||
echo "⚠️ Partial success - $SUCCESS_COUNT out of $TOTAL_COUNT jobs completed"
|
||
echo "Please check the individual job logs for details"
|
||
else
|
||
echo "❌ All jobs failed - please check the logs"
|
||
exit 1
|
||
fi
|
||
shell: bash
|
||
|
||
cleanup:
|
||
runs-on: ubuntu-latest
|
||
needs: [build-base-images, build-stable-diffusion-variants]
|
||
if: always()
|
||
|
||
steps:
|
||
- name: Clean up Docker resources
|
||
run: |
|
||
echo "🧹 Cleaning up Docker resources..."
|
||
|
||
# Clean up build cache and unused images
|
||
docker system prune -f --volumes || echo "⚠️ Docker system prune failed"
|
||
docker builder prune -f || echo "⚠️ Builder prune failed"
|
||
|
||
# Clean up buildx builders
|
||
docker buildx ls | grep -E "mybuilder|gitea-builder" | awk '{print $1}' | while read builder; do
|
||
echo "Removing builder: $builder"
|
||
docker buildx rm "$builder" || echo "⚠️ Failed to remove builder $builder"
|
||
done
|
||
|
||
echo "✅ Cleanup completed"
|
||
shell: bash |