Workflow file for this run
This file contains hidden or 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
| name: Build and Push Docker Images to NVCR | ||
|
Check failure on line 1 in .github/workflows/build-push-docker.yml
|
||
| on: | ||
| workflow_call: | ||
| inputs: | ||
| runner: | ||
| description: "Runner type for the build jobs" | ||
| required: false | ||
| default: "ubuntu-latest" | ||
| type: string | ||
| version: | ||
| description: "Version tag for Docker images" | ||
| required: true | ||
| type: string | ||
| short_sha: | ||
| description: "Short SHA for tagging" | ||
| required: true | ||
| type: string | ||
| target_registry: | ||
| description: "Target NVCR registry path" | ||
| required: true | ||
| type: string | ||
| push_enabled: | ||
| description: "Whether to push images to registry" | ||
| required: false | ||
| default: true | ||
| type: boolean | ||
| # Required secrets (must be configured in GitHub repository settings): | ||
| # - NVCR_USERNAME: NVIDIA Container Registry username (typically '$oauthtoken') | ||
| # - NVCR_TOKEN: NVIDIA Container Registry API token | ||
| # | ||
| # To configure secrets: | ||
| # 1. Go to your GitHub repository settings | ||
| # 2. Navigate to Secrets and variables > Actions | ||
| # 3. Click "New repository secret" | ||
| # 4. Add the following secrets: | ||
| # - Name: NVCR_USERNAME | ||
| # Value: $oauthtoken (or your NVCR username) | ||
| # - Name: NVCR_TOKEN | ||
| # Value: Your NVIDIA NGC API token (get from https://ngc.nvidia.com/) | ||
| jobs: | ||
| # Build and push carbide-rest-api | ||
| build-carbide-rest-api: | ||
| name: Build carbide-rest-api | ||
| runs-on: ${{ inputs.runner }} | ||
| permissions: | ||
| contents: read | ||
| packages: write | ||
| steps: | ||
| - name: Checkout code | ||
| uses: actions/checkout@v4 | ||
| - name: Set up Docker Buildx | ||
| uses: docker/setup-buildx-action@v3 | ||
| - name: Log in to NVIDIA Container Registry | ||
| if: ${{ inputs.push_enabled && secrets.NVCR_TOKEN != '' }} | ||
| uses: docker/login-action@v3 | ||
| with: | ||
| registry: nvcr.io | ||
| username: ${{ secrets.NVCR_USERNAME }} | ||
| password: ${{ secrets.NVCR_TOKEN }} | ||
| - name: Build and Push carbide-rest-api | ||
| uses: docker/build-push-action@v5 | ||
| with: | ||
| context: . | ||
| file: ./docker/production/Dockerfile.carbide-rest-api | ||
| platforms: linux/amd64 | ||
| push: ${{ inputs.push_enabled }} | ||
| tags: | | ||
| ${{ inputs.target_registry }}/carbide-rest-api:${{ inputs.short_sha }} | ||
| ${{ inputs.target_registry }}/carbide-rest-api:${{ inputs.version }} | ||
| ${{ inputs.target_registry }}/carbide-rest-api:latest | ||
| cache-from: type=gha,scope=carbide-rest-api | ||
| cache-to: type=gha,mode=max,scope=carbide-rest-api | ||
| labels: | | ||
| org.opencontainers.image.title=carbide-rest-api | ||
| org.opencontainers.image.version=${{ inputs.version }} | ||
| org.opencontainers.image.revision=${{ inputs.short_sha }} | ||
| org.opencontainers.image.created=${{ github.event.head_commit.timestamp }} | ||
| org.opencontainers.image.source=${{ github.repositoryUrl }} | ||
| org.opencontainers.image.url=${{ github.repositoryUrl }} | ||
| # Build and push carbide-rest-db | ||
| build-carbide-rest-db: | ||
| name: Build carbide-rest-db | ||
| runs-on: ${{ inputs.runner }} | ||
| permissions: | ||
| contents: read | ||
| packages: write | ||
| steps: | ||
| - name: Checkout code | ||
| uses: actions/checkout@v4 | ||
| - name: Set up Docker Buildx | ||
| uses: docker/setup-buildx-action@v3 | ||
| - name: Log in to NVIDIA Container Registry | ||
| if: ${{ inputs.push_enabled && secrets.NVCR_TOKEN != '' }} | ||
| uses: docker/login-action@v3 | ||
| with: | ||
| registry: nvcr.io | ||
| username: ${{ secrets.NVCR_USERNAME }} | ||
| password: ${{ secrets.NVCR_TOKEN }} | ||
| - name: Build and Push carbide-rest-db | ||
| uses: docker/build-push-action@v5 | ||
| with: | ||
| context: . | ||
| file: ./docker/production/Dockerfile.carbide-rest-db | ||
| platforms: linux/amd64 | ||
| push: ${{ inputs.push_enabled }} | ||
| tags: | | ||
| ${{ inputs.target_registry }}/carbide-rest-db:${{ inputs.short_sha }} | ||
| ${{ inputs.target_registry }}/carbide-rest-db:${{ inputs.version }} | ||
| ${{ inputs.target_registry }}/carbide-rest-db:latest | ||
| cache-from: type=gha,scope=carbide-rest-db | ||
| cache-to: type=gha,mode=max,scope=carbide-rest-db | ||
| labels: | | ||
| org.opencontainers.image.title=carbide-rest-db | ||
| org.opencontainers.image.version=${{ inputs.version }} | ||
| org.opencontainers.image.revision=${{ inputs.short_sha }} | ||
| org.opencontainers.image.created=${{ github.event.head_commit.timestamp }} | ||
| org.opencontainers.image.source=${{ github.repositoryUrl }} | ||
| org.opencontainers.image.url=${{ github.repositoryUrl }} | ||
| # Build and push carbide-rest-ipam | ||
| build-carbide-rest-ipam: | ||
| name: Build carbide-rest-ipam | ||
| runs-on: ${{ inputs.runner }} | ||
| permissions: | ||
| contents: read | ||
| packages: write | ||
| steps: | ||
| - name: Checkout code | ||
| uses: actions/checkout@v4 | ||
| - name: Set up Docker Buildx | ||
| uses: docker/setup-buildx-action@v3 | ||
| - name: Log in to NVIDIA Container Registry | ||
| if: ${{ inputs.push_enabled && secrets.NVCR_TOKEN != '' }} | ||
| uses: docker/login-action@v3 | ||
| with: | ||
| registry: nvcr.io | ||
| username: ${{ secrets.NVCR_USERNAME }} | ||
| password: ${{ secrets.NVCR_TOKEN }} | ||
| - name: Build and Push carbide-rest-ipam | ||
| uses: docker/build-push-action@v5 | ||
| with: | ||
| context: . | ||
| file: ./docker/production/Dockerfile.carbide-rest-ipam | ||
| platforms: linux/amd64 | ||
| push: ${{ inputs.push_enabled }} | ||
| tags: | | ||
| ${{ inputs.target_registry }}/carbide-rest-ipam:${{ inputs.short_sha }} | ||
| ${{ inputs.target_registry }}/carbide-rest-ipam:${{ inputs.version }} | ||
| ${{ inputs.target_registry }}/carbide-rest-ipam:latest | ||
| cache-from: type=gha,scope=carbide-rest-ipam | ||
| cache-to: type=gha,mode=max,scope=carbide-rest-ipam | ||
| labels: | | ||
| org.opencontainers.image.title=carbide-rest-ipam | ||
| org.opencontainers.image.version=${{ inputs.version }} | ||
| org.opencontainers.image.revision=${{ inputs.short_sha }} | ||
| org.opencontainers.image.created=${{ github.event.head_commit.timestamp }} | ||
| org.opencontainers.image.source=${{ github.repositoryUrl }} | ||
| org.opencontainers.image.url=${{ github.repositoryUrl }} | ||
| # Build and push carbide-rest-site-manager | ||
| build-carbide-rest-site-manager: | ||
| name: Build carbide-rest-site-manager | ||
| runs-on: ${{ inputs.runner }} | ||
| permissions: | ||
| contents: read | ||
| packages: write | ||
| steps: | ||
| - name: Checkout code | ||
| uses: actions/checkout@v4 | ||
| - name: Set up Docker Buildx | ||
| uses: docker/setup-buildx-action@v3 | ||
| - name: Log in to NVIDIA Container Registry | ||
| if: ${{ inputs.push_enabled && secrets.NVCR_TOKEN != '' }} | ||
| uses: docker/login-action@v3 | ||
| with: | ||
| registry: nvcr.io | ||
| username: ${{ secrets.NVCR_USERNAME }} | ||
| password: ${{ secrets.NVCR_TOKEN }} | ||
| - name: Build and Push carbide-rest-site-manager | ||
| uses: docker/build-push-action@v5 | ||
| with: | ||
| context: . | ||
| file: ./docker/production/Dockerfile.carbide-rest-site-manager | ||
| platforms: linux/amd64 | ||
| push: ${{ inputs.push_enabled }} | ||
| tags: | | ||
| ${{ inputs.target_registry }}/carbide-rest-site-manager:${{ inputs.short_sha }} | ||
| ${{ inputs.target_registry }}/carbide-rest-site-manager:${{ inputs.version }} | ||
| ${{ inputs.target_registry }}/carbide-rest-site-manager:latest | ||
| cache-from: type=gha,scope=carbide-rest-site-manager | ||
| cache-to: type=gha,mode=max,scope=carbide-rest-site-manager | ||
| labels: | | ||
| org.opencontainers.image.title=carbide-rest-site-manager | ||
| org.opencontainers.image.version=${{ inputs.version }} | ||
| org.opencontainers.image.revision=${{ inputs.short_sha }} | ||
| org.opencontainers.image.created=${{ github.event.head_commit.timestamp }} | ||
| org.opencontainers.image.source=${{ github.repositoryUrl }} | ||
| org.opencontainers.image.url=${{ github.repositoryUrl }} | ||
| # Build and push carbide-rest-workflow | ||
| build-carbide-rest-workflow: | ||
| name: Build carbide-rest-workflow | ||
| runs-on: ${{ inputs.runner }} | ||
| permissions: | ||
| contents: read | ||
| packages: write | ||
| steps: | ||
| - name: Checkout code | ||
| uses: actions/checkout@v4 | ||
| - name: Set up Docker Buildx | ||
| uses: docker/setup-buildx-action@v3 | ||
| - name: Log in to NVIDIA Container Registry | ||
| if: ${{ inputs.push_enabled && secrets.NVCR_TOKEN != '' }} | ||
| uses: docker/login-action@v3 | ||
| with: | ||
| registry: nvcr.io | ||
| username: ${{ secrets.NVCR_USERNAME }} | ||
| password: ${{ secrets.NVCR_TOKEN }} | ||
| - name: Build and Push carbide-rest-workflow | ||
| uses: docker/build-push-action@v5 | ||
| with: | ||
| context: . | ||
| file: ./docker/production/Dockerfile.carbide-rest-workflow | ||
| platforms: linux/amd64 | ||
| push: ${{ inputs.push_enabled }} | ||
| tags: | | ||
| ${{ inputs.target_registry }}/carbide-rest-workflow:${{ inputs.short_sha }} | ||
| ${{ inputs.target_registry }}/carbide-rest-workflow:${{ inputs.version }} | ||
| ${{ inputs.target_registry }}/carbide-rest-workflow:latest | ||
| cache-from: type=gha,scope=carbide-rest-workflow | ||
| cache-to: type=gha,mode=max,scope=carbide-rest-workflow | ||
| labels: | | ||
| org.opencontainers.image.title=carbide-rest-workflow | ||
| org.opencontainers.image.version=${{ inputs.version }} | ||
| org.opencontainers.image.revision=${{ inputs.short_sha }} | ||
| org.opencontainers.image.created=${{ github.event.head_commit.timestamp }} | ||
| org.opencontainers.image.source=${{ github.repositoryUrl }} | ||
| org.opencontainers.image.url=${{ github.repositoryUrl }} | ||
| # Build and push carbide-site-agent | ||
| build-carbide-site-agent: | ||
| name: Build carbide-site-agent | ||
| runs-on: ${{ inputs.runner }} | ||
| permissions: | ||
| contents: read | ||
| packages: write | ||
| steps: | ||
| - name: Checkout code | ||
| uses: actions/checkout@v4 | ||
| - name: Set up Docker Buildx | ||
| uses: docker/setup-buildx-action@v3 | ||
| - name: Log in to NVIDIA Container Registry | ||
| if: ${{ inputs.push_enabled && secrets.NVCR_TOKEN != '' }} | ||
| uses: docker/login-action@v3 | ||
| with: | ||
| registry: nvcr.io | ||
| username: ${{ secrets.NVCR_USERNAME }} | ||
| password: ${{ secrets.NVCR_TOKEN }} | ||
| - name: Build and Push carbide-site-agent | ||
| uses: docker/build-push-action@v5 | ||
| with: | ||
| context: . | ||
| file: ./docker/production/Dockerfile.carbide-site-agent | ||
| platforms: linux/amd64 | ||
| push: ${{ inputs.push_enabled }} | ||
| tags: | | ||
| ${{ inputs.target_registry }}/carbide-site-agent:${{ inputs.short_sha }} | ||
| ${{ inputs.target_registry }}/carbide-site-agent:${{ inputs.version }} | ||
| ${{ inputs.target_registry }}/carbide-site-agent:latest | ||
| cache-from: type=gha,scope=carbide-site-agent | ||
| cache-to: type=gha,mode=max,scope=carbide-site-agent | ||
| labels: | | ||
| org.opencontainers.image.title=carbide-site-agent | ||
| org.opencontainers.image.version=${{ inputs.version }} | ||
| org.opencontainers.image.revision=${{ inputs.short_sha }} | ||
| org.opencontainers.image.created=${{ github.event.head_commit.timestamp }} | ||
| org.opencontainers.image.source=${{ github.repositoryUrl }} | ||
| org.opencontainers.image.url=${{ github.repositoryUrl }} | ||
| # Build and push carbide-rest-cert-manager (credsmgr) | ||
| build-carbide-rest-cert-manager: | ||
| name: Build carbide-rest-cert-manager | ||
| runs-on: ${{ inputs.runner }} | ||
| permissions: | ||
| contents: read | ||
| packages: write | ||
| steps: | ||
| - name: Checkout code | ||
| uses: actions/checkout@v4 | ||
| - name: Set up Docker Buildx | ||
| uses: docker/setup-buildx-action@v3 | ||
| - name: Log in to NVIDIA Container Registry | ||
| if: ${{ inputs.push_enabled && secrets.NVCR_TOKEN != '' }} | ||
| uses: docker/login-action@v3 | ||
| with: | ||
| registry: nvcr.io | ||
| username: ${{ secrets.NVCR_USERNAME }} | ||
| password: ${{ secrets.NVCR_TOKEN }} | ||
| - name: Build and Push carbide-rest-cert-manager | ||
| uses: docker/build-push-action@v5 | ||
| with: | ||
| context: . | ||
| file: ./docker/production/Dockerfile.carbide-rest-cert-manager | ||
| platforms: linux/amd64 | ||
| push: ${{ inputs.push_enabled }} | ||
| tags: | | ||
| ${{ inputs.target_registry }}/carbide-rest-cert-manager:${{ inputs.short_sha }} | ||
| ${{ inputs.target_registry }}/carbide-rest-cert-manager:${{ inputs.version }} | ||
| ${{ inputs.target_registry }}/carbide-rest-cert-manager:latest | ||
| cache-from: type=gha,scope=carbide-rest-cert-manager | ||
| cache-to: type=gha,mode=max,scope=carbide-rest-cert-manager | ||
| labels: | | ||
| org.opencontainers.image.title=carbide-rest-cert-manager | ||
| org.opencontainers.image.version=${{ inputs.version }} | ||
| org.opencontainers.image.revision=${{ inputs.short_sha }} | ||
| org.opencontainers.image.created=${{ github.event.head_commit.timestamp }} | ||
| org.opencontainers.image.source=${{ github.repositoryUrl }} | ||
| org.opencontainers.image.url=${{ github.repositoryUrl }} | ||
| # Build summary | ||
| build-summary: | ||
| name: Build Summary | ||
| runs-on: ${{ inputs.runner }} | ||
| needs: | ||
| - build-carbide-rest-api | ||
| - build-carbide-rest-db | ||
| - build-carbide-rest-ipam | ||
| - build-carbide-rest-site-manager | ||
| - build-carbide-rest-workflow | ||
| - build-carbide-site-agent | ||
| - build-carbide-rest-cert-manager | ||
| if: always() | ||
| steps: | ||
| - name: Generate build summary | ||
| run: | | ||
| echo "# Docker Build Summary" >> $GITHUB_STEP_SUMMARY | ||
| echo "" >> $GITHUB_STEP_SUMMARY | ||
| echo "## Build Information" >> $GITHUB_STEP_SUMMARY | ||
| echo "- **Version**: \`${{ inputs.version }}\`" >> $GITHUB_STEP_SUMMARY | ||
| echo "- **Git SHA**: \`${{ inputs.short_sha }}\`" >> $GITHUB_STEP_SUMMARY | ||
| echo "- **Branch**: \`${{ github.ref_name }}\`" >> $GITHUB_STEP_SUMMARY | ||
| echo "- **Registry**: \`${{ inputs.target_registry }}\`" >> $GITHUB_STEP_SUMMARY | ||
| echo "- **Push Enabled**: \`${{ inputs.push_enabled }}\`" >> $GITHUB_STEP_SUMMARY | ||
| echo "" >> $GITHUB_STEP_SUMMARY | ||
| if [ "${{ inputs.push_enabled }}" == "false" ]; then | ||
| echo "> **Note**: Images were built but NOT pushed to registry (build-only mode)" >> $GITHUB_STEP_SUMMARY | ||
| echo "" >> $GITHUB_STEP_SUMMARY | ||
| fi | ||
| echo "## Images Built" >> $GITHUB_STEP_SUMMARY | ||
| echo "1. \`carbide-rest-api:${{ inputs.short_sha }}\`" >> $GITHUB_STEP_SUMMARY | ||
| echo "2. \`carbide-rest-db:${{ inputs.short_sha }}\`" >> $GITHUB_STEP_SUMMARY | ||
| echo "3. \`carbide-rest-ipam:${{ inputs.short_sha }}\`" >> $GITHUB_STEP_SUMMARY | ||
| echo "4. \`carbide-rest-site-manager:${{ inputs.short_sha }}\`" >> $GITHUB_STEP_SUMMARY | ||
| echo "5. \`carbide-rest-workflow:${{ inputs.short_sha }}\`" >> $GITHUB_STEP_SUMMARY | ||
| echo "6. \`carbide-site-agent:${{ inputs.short_sha }}\`" >> $GITHUB_STEP_SUMMARY | ||
| echo "7. \`carbide-rest-cert-manager:${{ inputs.short_sha }}\`" >> $GITHUB_STEP_SUMMARY | ||
| echo "" >> $GITHUB_STEP_SUMMARY | ||
| echo "## Job Status" >> $GITHUB_STEP_SUMMARY | ||
| echo "- carbide-rest-api: \`${{ needs.build-carbide-rest-api.result }}\`" >> $GITHUB_STEP_SUMMARY | ||
| echo "- carbide-rest-db: \`${{ needs.build-carbide-rest-db.result }}\`" >> $GITHUB_STEP_SUMMARY | ||
| echo "- carbide-rest-ipam: \`${{ needs.build-carbide-rest-ipam.result }}\`" >> $GITHUB_STEP_SUMMARY | ||
| echo "- carbide-rest-site-manager: \`${{ needs.build-carbide-rest-site-manager.result }}\`" >> $GITHUB_STEP_SUMMARY | ||
| echo "- carbide-rest-workflow: \`${{ needs.build-carbide-rest-workflow.result }}\`" >> $GITHUB_STEP_SUMMARY | ||
| echo "- carbide-site-agent: \`${{ needs.build-carbide-site-agent.result }}\`" >> $GITHUB_STEP_SUMMARY | ||
| echo "- carbide-rest-cert-manager: \`${{ needs.build-carbide-rest-cert-manager.result }}\`" >> $GITHUB_STEP_SUMMARY | ||