diff --git a/.github/workflows/ghcr_amd64.yml b/.github/workflows/ghcr_amd64.yml index 1f90d672..ca76d963 100644 --- a/.github/workflows/ghcr_amd64.yml +++ b/.github/workflows/ghcr_amd64.yml @@ -5,69 +5,15 @@ on: tags: - 'v*' -env: - # Prefix for the image name. - FLAVOR_PREFIX: "" - # Will be used in the Dockerfile generation script. - RUNTIME_DOCKERFILE: Dockerfile - # The platforms to build for. - PLATFORMS: linux/amd64 - jobs: build-base: - name: Build base image - runs-on: ubuntu-latest - permissions: - packages: write - contents: read - steps: - - name: Checkout - uses: actions/checkout@v4 - with: - fetch-depth: 0 - - - name: Set up QEMU - uses: docker/setup-qemu-action@v3 - - - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v3 - - - name: Extract metadata (tags, labels) for Docker - uses: docker/metadata-action@v5 - id: meta - with: - images: ghcr.io/${{ github.repository }}/${{ env.FLAVOR_PREFIX }}base - tags: | - type=semver,pattern={{version}} - type=semver,pattern={{major}}.{{minor}} - type=semver,pattern={{major}} - type=sha,format=long - - - name: Log in to the Container registry - uses: docker/login-action@v3 - with: - registry: ghcr.io - username: ${{ github.actor }} - password: ${{ secrets.GITHUB_TOKEN }} - - - name: Generate base Dockerfile - run: go run docker/main.go -i Dockerfile.tmpl -o Dockerfile - - - name: Build and push - uses: docker/build-push-action@v6 - with: - context: ./ - push: true - tags: ${{ steps.meta.outputs.tags }} - labels: ${{ steps.meta.outputs.labels }} - platforms: ${{ env.PLATFORMS }} + uses: ./.github/workflows/image_base.yml + with: + platforms: linux/amd64 + dockerfile: Dockerfile build-apps: - name: Build application images - runs-on: ubuntu-latest - permissions: - packages: write - contents: read + uses: ./.github/workflows/image_app.yml needs: [ build-base ] strategy: # Will build all images even if some fail. @@ -87,44 +33,7 @@ jobs: - name: vlc - name: xfce - name: kde - steps: - - name: Checkout - uses: actions/checkout@v4 - with: - fetch-depth: 0 - - - name: Set up QEMU - uses: docker/setup-qemu-action@v3 - - - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v3 - - - name: Extract metadata (tags, labels) for Docker - uses: docker/metadata-action@v5 - id: meta - with: - images: ghcr.io/${{ github.repository }}/${{ env.FLAVOR_PREFIX }}${{ matrix.name }} - tags: | - type=semver,pattern={{version}} - type=semver,pattern={{major}}.{{minor}} - type=semver,pattern={{major}} - type=sha,format=long - - - name: Log in to the Container registry - uses: docker/login-action@v3 - with: - registry: ghcr.io - username: ${{ github.actor }} - password: ${{ secrets.GITHUB_TOKEN }} - - - name: Build and push - uses: docker/build-push-action@v6 - with: - context: apps/${{ matrix.name }} - file: apps/${{ matrix.name }}/${ matrix.dockerfile || 'Dockerfile' }} - push: true - tags: ${{ steps.meta.outputs.tags }} - labels: ${{ steps.meta.outputs.labels }} - build-args: | - BASE_IMAGE=ghcr.io/${{ github.repository }}/${{ env.FLAVOR_PREFIX }}base:sha-${{ github.sha }} - platforms: ${{ env.PLATFORMS }} + with: + name: ${{ matrix.name }} + dockerfile: ${{ matrix.dockerfile }} + platforms: linux/amd64 diff --git a/.github/workflows/ghcr_arm.yml b/.github/workflows/ghcr_arm.yml index d17897ab..26ee5eb2 100644 --- a/.github/workflows/ghcr_arm.yml +++ b/.github/workflows/ghcr_arm.yml @@ -5,79 +5,16 @@ on: tags: - 'v*' -env: - # Prefix for the image name. - FLAVOR_PREFIX: "arm-" - # Will be used in the Dockerfile generation script. - RUNTIME_DOCKERFILE: Dockerfile.arm - # The platforms to build for. - PLATFORMS: linux/arm64 - jobs: - build-client: - uses: ./.github/workflows/client_build.yml - build-base: - name: Build base image - runs-on: ubuntu-latest - needs: [ build-client ] - permissions: - packages: write - contents: read - steps: - - name: Checkout - uses: actions/checkout@v4 - with: - fetch-depth: 0 - - - name: Download client dist - uses: actions/download-artifact@v4 - with: - name: client - path: client/dist - - - name: Set up QEMU - uses: docker/setup-qemu-action@v3 - - - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v3 - - - name: Extract metadata (tags, labels) for Docker - uses: docker/metadata-action@v5 - id: meta - with: - images: ghcr.io/${{ github.repository }}/${{ env.FLAVOR_PREFIX }}base - tags: | - type=semver,pattern={{version}} - type=semver,pattern={{major}}.{{minor}} - type=semver,pattern={{major}} - type=sha,format=long - - - name: Log in to the Container registry - uses: docker/login-action@v3 - with: - registry: ghcr.io - username: ${{ github.actor }} - password: ${{ secrets.GITHUB_TOKEN }} - - - name: Generate base Dockerfile - run: go run docker/main.go -i Dockerfile.tmpl -o Dockerfile -client client/dist - - - name: Build and push - uses: docker/build-push-action@v6 - with: - context: ./ - push: true - tags: ${{ steps.meta.outputs.tags }} - labels: ${{ steps.meta.outputs.labels }} - platforms: ${{ env.PLATFORMS }} + uses: ./.github/workflows/image_base.yml + with: + flavor: arm + platforms: linux/arm64 + dockerfile: Dockerfile.arm build-apps: - name: Build application images - runs-on: ubuntu-latest - permissions: - packages: write - contents: read + uses: ./.github/workflows/image_app.yml needs: [ build-base ] strategy: # Will build all images even if some fail. @@ -91,44 +28,8 @@ jobs: - name: tor-browser - name: vlc - name: xfce - steps: - - name: Checkout - uses: actions/checkout@v4 - with: - fetch-depth: 0 - - - name: Set up QEMU - uses: docker/setup-qemu-action@v3 - - - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v3 - - - name: Extract metadata (tags, labels) for Docker - uses: docker/metadata-action@v5 - id: meta - with: - images: ghcr.io/${{ github.repository }}/${{ env.FLAVOR_PREFIX }}${{ matrix.name }} - tags: | - type=semver,pattern={{version}} - type=semver,pattern={{major}}.{{minor}} - type=semver,pattern={{major}} - type=sha,format=long - - - name: Log in to the Container registry - uses: docker/login-action@v3 - with: - registry: ghcr.io - username: ${{ github.actor }} - password: ${{ secrets.GITHUB_TOKEN }} - - - name: Build and push - uses: docker/build-push-action@v6 - with: - context: apps/${{ matrix.name }} - file: apps/${{ matrix.name }}/${ matrix.dockerfile || 'Dockerfile' }} - push: true - tags: ${{ steps.meta.outputs.tags }} - labels: ${{ steps.meta.outputs.labels }} - build-args: | - BASE_IMAGE=ghcr.io/${{ github.repository }}/${{ env.FLAVOR_PREFIX }}base:sha-${{ github.sha }} - platforms: ${{ env.PLATFORMS }} + with: + name: ${{ matrix.name }} + dockerfile: ${{ matrix.dockerfile }} + flavor: arm + platforms: linux/arm64 diff --git a/.github/workflows/ghcr_intel.yml b/.github/workflows/ghcr_intel.yml index 9f651aa4..5c2b0293 100644 --- a/.github/workflows/ghcr_intel.yml +++ b/.github/workflows/ghcr_intel.yml @@ -5,69 +5,16 @@ on: tags: - 'v*' -env: - # Prefix for the image name. - FLAVOR_PREFIX: "intel-" - # Will be used in the Dockerfile generation script. - RUNTIME_DOCKERFILE: Dockerfile.intel - # The platforms to build for. - PLATFORMS: linux/amd64 - jobs: build-base: - name: Build base image - runs-on: ubuntu-latest - permissions: - packages: write - contents: read - steps: - - name: Checkout - uses: actions/checkout@v4 - with: - fetch-depth: 0 - - - name: Set up QEMU - uses: docker/setup-qemu-action@v3 - - - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v3 - - - name: Extract metadata (tags, labels) for Docker - uses: docker/metadata-action@v5 - id: meta - with: - images: ghcr.io/${{ github.repository }}/${{ env.FLAVOR_PREFIX }}base - tags: | - type=semver,pattern={{version}} - type=semver,pattern={{major}}.{{minor}} - type=semver,pattern={{major}} - type=sha,format=long - - - name: Log in to the Container registry - uses: docker/login-action@v3 - with: - registry: ghcr.io - username: ${{ github.actor }} - password: ${{ secrets.GITHUB_TOKEN }} - - - name: Generate base Dockerfile - run: go run docker/main.go -i Dockerfile.tmpl -o Dockerfile - - - name: Build and push - uses: docker/build-push-action@v6 - with: - context: ./ - push: true - tags: ${{ steps.meta.outputs.tags }} - labels: ${{ steps.meta.outputs.labels }} - platforms: ${{ env.PLATFORMS }} + uses: ./.github/workflows/image_base.yml + with: + flavor: intel + platforms: linux/amd64 + dockerfile: Dockerfile.intel build-apps: - name: Build application images - runs-on: ubuntu-latest - permissions: - packages: write - contents: read + uses: ./.github/workflows/image_app.yml needs: [ build-base ] strategy: # Will build all images even if some fail. @@ -87,44 +34,8 @@ jobs: - name: vlc - name: xfce - name: kde - steps: - - name: Checkout - uses: actions/checkout@v4 - with: - fetch-depth: 0 - - - name: Set up QEMU - uses: docker/setup-qemu-action@v3 - - - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v3 - - - name: Extract metadata (tags, labels) for Docker - uses: docker/metadata-action@v5 - id: meta - with: - images: ghcr.io/${{ github.repository }}/${{ env.FLAVOR_PREFIX }}${{ matrix.name }} - tags: | - type=semver,pattern={{version}} - type=semver,pattern={{major}}.{{minor}} - type=semver,pattern={{major}} - type=sha,format=long - - - name: Log in to the Container registry - uses: docker/login-action@v3 - with: - registry: ghcr.io - username: ${{ github.actor }} - password: ${{ secrets.GITHUB_TOKEN }} - - - name: Build and push - uses: docker/build-push-action@v6 - with: - context: apps/${{ matrix.name }} - file: apps/${{ matrix.name }}/${ matrix.dockerfile || 'Dockerfile' }} - push: true - tags: ${{ steps.meta.outputs.tags }} - labels: ${{ steps.meta.outputs.labels }} - build-args: | - BASE_IMAGE=ghcr.io/${{ github.repository }}/${{ env.FLAVOR_PREFIX }}base:sha-${{ github.sha }} - platforms: ${{ env.PLATFORMS }} + with: + name: ${{ matrix.name }} + dockerfile: ${{ matrix.dockerfile }} + flavor: intel + platforms: linux/amd64 diff --git a/.github/workflows/ghcr_nvidia.yml b/.github/workflows/ghcr_nvidia.yml index 2d221420..07671c38 100644 --- a/.github/workflows/ghcr_nvidia.yml +++ b/.github/workflows/ghcr_nvidia.yml @@ -5,69 +5,16 @@ on: tags: - 'v*' -env: - # Prefix for the image name. - FLAVOR_PREFIX: "nvidia-" - # Will be used in the Dockerfile generation script. - RUNTIME_DOCKERFILE: Dockerfile.nvidia - # The platforms to build for. - PLATFORMS: linux/amd64 - jobs: build-base: - name: Build base image - runs-on: ubuntu-latest - permissions: - packages: write - contents: read - steps: - - name: Checkout - uses: actions/checkout@v4 - with: - fetch-depth: 0 - - - name: Set up QEMU - uses: docker/setup-qemu-action@v3 - - - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v3 - - - name: Extract metadata (tags, labels) for Docker - uses: docker/metadata-action@v5 - id: meta - with: - images: ghcr.io/${{ github.repository }}/${{ env.FLAVOR_PREFIX }}base - tags: | - type=semver,pattern={{version}} - type=semver,pattern={{major}}.{{minor}} - type=semver,pattern={{major}} - type=sha,format=long - - - name: Log in to the Container registry - uses: docker/login-action@v3 - with: - registry: ghcr.io - username: ${{ github.actor }} - password: ${{ secrets.GITHUB_TOKEN }} - - - name: Generate base Dockerfile - run: go run docker/main.go -i Dockerfile.tmpl -o Dockerfile - - - name: Build and push - uses: docker/build-push-action@v6 - with: - context: ./ - push: true - tags: ${{ steps.meta.outputs.tags }} - labels: ${{ steps.meta.outputs.labels }} - platforms: ${{ env.PLATFORMS }} + uses: ./.github/workflows/image_base.yml + with: + flavor: nvidia + platforms: linux/amd64 + dockerfile: Dockerfile.nvidia build-apps: - name: Build application images - runs-on: ubuntu-latest - permissions: - packages: write - contents: read + uses: ./.github/workflows/image_app.yml needs: [ build-base ] strategy: # Will build all images even if some fail. @@ -83,44 +30,8 @@ jobs: dockerfile: Dockerfile.nvidia - name: microsoft-edge dockerfile: Dockerfile.nvidia - steps: - - name: Checkout - uses: actions/checkout@v4 - with: - fetch-depth: 0 - - - name: Set up QEMU - uses: docker/setup-qemu-action@v3 - - - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v3 - - - name: Extract metadata (tags, labels) for Docker - uses: docker/metadata-action@v5 - id: meta - with: - images: ghcr.io/${{ github.repository }}/${{ env.FLAVOR_PREFIX }}${{ matrix.name }} - tags: | - type=semver,pattern={{version}} - type=semver,pattern={{major}}.{{minor}} - type=semver,pattern={{major}} - type=sha,format=long - - - name: Log in to the Container registry - uses: docker/login-action@v3 - with: - registry: ghcr.io - username: ${{ github.actor }} - password: ${{ secrets.GITHUB_TOKEN }} - - - name: Build and push - uses: docker/build-push-action@v6 - with: - context: apps/${{ matrix.name }} - file: apps/${{ matrix.name }}/${ matrix.dockerfile || 'Dockerfile' }} - push: true - tags: ${{ steps.meta.outputs.tags }} - labels: ${{ steps.meta.outputs.labels }} - build-args: | - BASE_IMAGE=ghcr.io/${{ github.repository }}/${{ env.FLAVOR_PREFIX }}base:sha-${{ github.sha }} - platforms: ${{ env.PLATFORMS }} + with: + name: ${{ matrix.name }} + dockerfile: ${{ matrix.dockerfile }} + flavor: nvidia + platforms: linux/amd64 diff --git a/.github/workflows/image_app.yml b/.github/workflows/image_app.yml new file mode 100644 index 00000000..4328137d --- /dev/null +++ b/.github/workflows/image_app.yml @@ -0,0 +1,76 @@ +name: Build and Publish Application Image + +on: + workflow_call: + inputs: + name: + required: true + type: string + description: "The name of the application to build." + dockerfile: + required: false + type: string + default: "Dockerfile" + description: "The Dockerfile to use for building the image." + flavor: + required: false + type: string + default: "" + description: "The flavor of the image to build." + platforms: + required: false + type: string + default: "linux/amd64" + description: "The platforms to build for." + +env: + FLAVOR_PREFIX: ${{ inputs.flavor && inputs.flavor + '-' || '' }} + +jobs: + build-app: + name: Build and Publish Application Image + runs-on: ubuntu-latest + permissions: + packages: write + contents: read + steps: + - name: Checkout + uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - name: Set up QEMU + uses: docker/setup-qemu-action@v3 + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + + - name: Extract metadata (tags, labels) for Docker + uses: docker/metadata-action@v5 + id: meta + with: + images: ghcr.io/${{ github.repository }}/${{ env.FLAVOR_PREFIX }}${{ inputs.name }} + tags: | + type=semver,pattern={{version}} + type=semver,pattern={{major}}.{{minor}} + type=semver,pattern={{major}} + type=sha,format=long + + - name: Log in to the Container registry + uses: docker/login-action@v3 + with: + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: Build and push + uses: docker/build-push-action@v6 + with: + context: apps/${{ inputs.name }} + file: apps/${{ inputs.name }}/${ inputs.dockerfile || 'Dockerfile' }} + push: true + tags: ${{ steps.meta.outputs.tags }} + labels: ${{ steps.meta.outputs.labels }} + build-args: | + BASE_IMAGE=ghcr.io/${{ github.repository }}/${{ env.FLAVOR_PREFIX }}base:sha-${{ github.sha }} + platforms: ${{ inputs.platforms || 'linux/amd64' }} diff --git a/.github/workflows/image_base.yml b/.github/workflows/image_base.yml new file mode 100644 index 00000000..deedf3c5 --- /dev/null +++ b/.github/workflows/image_base.yml @@ -0,0 +1,84 @@ +name: Build and Publish Base Image + +on: + workflow_call: + inputs: + dockerfile: + required: false + type: string + default: "Dockerfile" + description: "The Dockerfile to use for building the image." + flavor: + required: false + type: string + default: "" + description: "The flavor of the image to build. This is used to determine the base image and the Dockerfile to use." + platforms: + required: false + type: string + default: "linux/amd64" + description: "The platforms to build for." + +env: + FLAVOR_PREFIX: ${{ inputs.flavor && inputs.flavor + '-' || '' }} + +jobs: + build-client: + uses: ./.github/workflows/client_build.yml + + build-base: + name: Build and Publish Base Image + runs-on: ubuntu-latest + needs: [ build-client ] + permissions: + packages: write + contents: read + steps: + - name: Checkout + uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - name: Download client dist + uses: actions/download-artifact@v4 + with: + name: client + path: client/dist + + - name: Set up QEMU + uses: docker/setup-qemu-action@v3 + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + + - name: Extract metadata (tags, labels) for Docker + uses: docker/metadata-action@v5 + id: meta + with: + images: ghcr.io/${{ github.repository }}/${{ env.FLAVOR_PREFIX }}base + tags: | + type=semver,pattern={{version}} + type=semver,pattern={{major}}.{{minor}} + type=semver,pattern={{major}} + type=sha,format=long + + - name: Log in to the Container registry + uses: docker/login-action@v3 + with: + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: Generate base Dockerfile + env: + RUNTIME_DOCKERFILE: ${{ inputs.dockerfile }} + run: go run docker/main.go -i Dockerfile.tmpl -o Dockerfile -client client/dist + + - name: Build and push + uses: docker/build-push-action@v6 + with: + context: ./ + push: true + tags: ${{ steps.meta.outputs.tags }} + labels: ${{ steps.meta.outputs.labels }} + platforms: ${{ inputs.platforms || 'linux/amd64' }}