name: Daily ROCm Container Build 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: Checkout repository uses: actions/checkout@v4 - name: Get current date id: date run: echo "date=$(date +'%Y-%m-%d')" >> $GITHUB_OUTPUT - name: Set variables id: vars run: echo "sha_short=$(echo ${GITHUB_SHA} | cut -c1-7)" >> $GITHUB_OUTPUT 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: Checkout repository uses: actions/checkout@v4 - name: Set up Docker Buildx uses: docker/setup-buildx-action@v3 with: driver-opts: network=host - name: Log in to Docker Hub if: github.event_name == 'schedule' || (github.event_name == 'workflow_dispatch' && github.event.inputs.push_images == 'true') uses: docker/login-action@v3 with: registry: ${{ env.REGISTRY }} username: ${{ env.REGISTRY_USER }} password: ${{ secrets.DOCKER_PASSWORD }} - name: Extract metadata id: meta uses: docker/metadata-action@v5 with: images: ${{ env.REGISTRY }}/${{ env.REGISTRY_USER }}/${{ matrix.image.name }} tags: | type=raw,value=latest type=raw,value=${{ needs.prepare.outputs.date }} type=raw,value=${{ needs.prepare.outputs.sha_short }} - name: Build and push Docker image uses: docker/build-push-action@v5 with: context: ${{ matrix.image.context }} file: Dockerfiles/${{ matrix.image.dockerfile }} push: ${{ github.event_name == 'schedule' || (github.event_name == 'workflow_dispatch' && github.event.inputs.push_images == 'true') }} tags: ${{ steps.meta.outputs.tags }} labels: ${{ steps.meta.outputs.labels }} platforms: linux/amd64 cache-from: type=gha cache-to: type=gha,mode=max build-args: | BUILD_DATE=${{ needs.prepare.outputs.date }} VCS_REF=${{ needs.prepare.outputs.sha_short }} 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: Checkout repository uses: actions/checkout@v4 - name: Set up Docker Buildx uses: docker/setup-buildx-action@v3 with: driver-opts: network=host - name: Log in to Docker Hub if: github.event_name == 'schedule' || (github.event_name == 'workflow_dispatch' && github.event.inputs.push_images == 'true') uses: docker/login-action@v3 with: registry: ${{ env.REGISTRY }} username: ${{ env.REGISTRY_USER }} password: ${{ secrets.DOCKER_PASSWORD }} - name: Extract metadata id: meta uses: docker/metadata-action@v5 with: images: ${{ env.REGISTRY }}/${{ env.REGISTRY_USER }}/stable-diffusion-cpp-${{ matrix.gfx_arch }} tags: | type=raw,value=latest type=raw,value=${{ needs.prepare.outputs.date }} type=raw,value=${{ needs.prepare.outputs.sha_short }} - name: Build and push Docker image uses: docker/build-push-action@v5 with: context: . file: Dockerfiles/Dockerfile.stable-diffusion.cpp-rocm7.1 push: ${{ github.event_name == 'schedule' || (github.event_name == 'workflow_dispatch' && github.event.inputs.push_images == 'true') }} tags: ${{ steps.meta.outputs.tags }} labels: ${{ steps.meta.outputs.labels }} platforms: linux/amd64 cache-from: type=gha,scope=${{ matrix.gfx_arch }} cache-to: type=gha,mode=max,scope=${{ matrix.gfx_arch }} build-args: | GFX_ARCH=${{ matrix.gfx_arch }} BUILD_DATE=${{ needs.prepare.outputs.date }} VCS_REF=${{ needs.prepare.outputs.sha_short }} test-compose: runs-on: ubuntu-latest needs: [prepare, build-base-images] if: github.event_name == 'schedule' || github.event_name == 'workflow_dispatch' steps: - name: Checkout repository uses: actions/checkout@v4 - name: Set up Docker Compose run: | 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 - name: Create test directories run: | mkdir -p User-Directories/open-webui mkdir -p User-Directories/ollama mkdir -p User-Directories/comfyui - name: Test docker-compose configuration run: | docker-compose config --quiet echo "โœ… Docker Compose configuration is valid" - name: Test image pulls (dry-run) run: | # Test if images can be pulled (without actually starting services) docker-compose pull --quiet || echo "โš ๏ธ Some images may not be available yet" notify: runs-on: ubuntu-latest needs: [prepare, build-base-images, build-stable-diffusion-variants, test-compose] if: always() && (github.event_name == 'schedule') steps: - name: Notify on success if: needs.build-base-images.result == 'success' && needs.build-stable-diffusion-variants.result == 'success' run: | echo "โœ… Daily build completed successfully on ${{ needs.prepare.outputs.date }}" echo "๐Ÿณ Base images built and pushed" echo "๐ŸŽฏ GPU-specific variants built and pushed" echo "๐Ÿ“‹ Docker Compose configuration validated" - name: Notify on failure if: needs.build-base-images.result == 'failure' || needs.build-stable-diffusion-variants.result == 'failure' run: | echo "โŒ Daily build failed on ${{ needs.prepare.outputs.date }}" echo "Please check the workflow logs for details" exit 1 cleanup: runs-on: ubuntu-latest needs: [build-base-images, build-stable-diffusion-variants] if: always() steps: - name: Clean up Docker cache run: | docker system prune -f --volumes echo "๐Ÿงน Docker cache cleaned up"