name: Docker-Builder on: workflow_dispatch: schedule: - cron: '2 0 * * *' # Daily at 00:02 UTC release: types: [ published ] jobs: translate: runs-on: ubuntu-22.04 name: Run Translations steps: - name: Checkout repository uses: actions/checkout@v5 - name: Set up Node.js uses: actions/setup-node@v6 with: node-version: "lts/*" - name: Run translate.js (ignore errors) run: node translate.js || true working-directory: translate - name: Run translate extractall run: node translate extractall working-directory: translate - name: Run translate.js minifyall run: node translate.js minifyall working-directory: translate - name: Run translate.js translateall run: node translate.js translateall working-directory: translate - name: Upload repo with translations uses: actions/upload-artifact@v5 with: name: repo-with-translations path: . build-amd64: runs-on: ubuntu-22.04 needs: translate strategy: fail-fast: false max-parallel: 3 matrix: variant: [mongodb, postgresql, mariadb, all, slim] name: Build Docker Image (amd64-${{ matrix.variant }}) steps: - name: Download repo artifact uses: actions/download-artifact@v5 with: name: repo-with-translations - name: Set up QEMU uses: docker/setup-qemu-action@v3 with: cache-image: false platforms: amd64 - name: Set up Docker Buildx uses: docker/setup-buildx-action@v3 with: cache-binary: false - name: Log in to GitHub Container Registry uses: docker/login-action@v3 with: registry: ghcr.io username: ${{ github.repository_owner }} password: ${{ secrets.MY_TOKEN || secrets.GITHUB_TOKEN }} - name: Build and push Docker image (amd64-${{ matrix.variant }}) run: | REPO_OWNER_LC="$(echo "${{ github.repository_owner }}" | tr '[:upper:]' '[:lower:]')" case "${{ matrix.variant }}" in mongodb) MONGODB=YES; POSTGRESQL=NO; MARIADB=NO; TAG="-amd64-mongodb";; postgresql) MONGODB=NO; POSTGRESQL=YES; MARIADB=NO; TAG="-amd64-postgresql";; mariadb) MONGODB=NO; POSTGRESQL=NO; MARIADB=YES; TAG="-amd64-mariadb";; all) MONGODB=YES; POSTGRESQL=YES; MARIADB=YES; TAG="-amd64";; slim) MONGODB=NO; POSTGRESQL=NO; MARIADB=NO; TAG="-amd64-slim";; esac docker buildx build \ --platform linux/amd64 \ --build-arg INCLUDE_MONGODB_TOOLS=$MONGODB \ --build-arg INCLUDE_POSTGRESQL_TOOLS=$POSTGRESQL \ --build-arg INCLUDE_MARIADB_TOOLS=$MARIADB \ --build-arg DISABLE_MINIFY=yes \ --build-arg DISABLE_TRANSLATE=yes \ --build-arg DISABLE_EXTRACT=yes \ --build-arg PREINSTALL_LIBS=true \ -f docker/Dockerfile \ -t ghcr.io/$REPO_OWNER_LC/meshcentral:${{ github.ref_name }}$TAG \ --push \ . build-arm64: runs-on: ubuntu-22.04 needs: translate strategy: fail-fast: false max-parallel: 3 matrix: variant: [mongodb, postgresql, mariadb, all, slim] name: Build Docker Image (arm64-${{ matrix.variant }}) steps: - name: Download repo artifact uses: actions/download-artifact@v5 with: name: repo-with-translations - name: Set up QEMU uses: docker/setup-qemu-action@v3 with: cache-image: false platforms: arm64 - name: Set up Docker Buildx uses: docker/setup-buildx-action@v3 with: cache-binary: false - name: Log in to GitHub Container Registry uses: docker/login-action@v3 with: registry: ghcr.io username: ${{ github.repository_owner }} password: ${{ secrets.MY_TOKEN || secrets.GITHUB_TOKEN }} - name: Build and push Docker image (arm64-${{ matrix.variant }}) run: | REPO_OWNER_LC="$(echo "${{ github.repository_owner }}" | tr '[:upper:]' '[:lower:]')" case "${{ matrix.variant }}" in mongodb) MONGODB=YES; POSTGRESQL=NO; MARIADB=NO; TAG="-arm64-mongodb";; postgresql) MONGODB=NO; POSTGRESQL=YES; MARIADB=NO; TAG="-arm64-postgresql";; mariadb) MONGODB=NO; POSTGRESQL=NO; MARIADB=YES; TAG="-arm64-mariadb";; all) MONGODB=YES; POSTGRESQL=YES; MARIADB=YES; TAG="-arm64";; slim) MONGODB=NO; POSTGRESQL=NO; MARIADB=NO; TAG="-arm64-slim";; esac docker buildx build \ --platform linux/arm64 \ --build-arg INCLUDE_MONGODB_TOOLS=$MONGODB \ --build-arg INCLUDE_POSTGRESQL_TOOLS=$POSTGRESQL \ --build-arg INCLUDE_MARIADB_TOOLS=$MARIADB \ --build-arg DISABLE_MINIFY=yes \ --build-arg DISABLE_TRANSLATE=yes \ --build-arg DISABLE_EXTRACT=yes \ --build-arg PREINSTALL_LIBS=true \ -f docker/Dockerfile \ -t ghcr.io/$REPO_OWNER_LC/meshcentral:${{ github.ref_name }}$TAG \ --push \ . merge-manifest: runs-on: ubuntu-22.04 needs: - translate - build-amd64 - build-arm64 name: Create and Push Multi-Arch Manifest steps: - name: Set up Docker Buildx uses: docker/setup-buildx-action@v3 with: cache-binary: false - name: Log in to GitHub Container Registry uses: docker/login-action@v3 with: registry: ghcr.io username: ${{ github.repository_owner }} password: ${{ secrets.MY_TOKEN || secrets.GITHUB_TOKEN }} - name: Create and push multi-arch manifests for all variants run: | REPO_OWNER_LC="$(echo "${{ github.repository_owner }}" | tr '[:upper:]' '[:lower:]')" # mongodb docker buildx imagetools create \ -t ghcr.io/$REPO_OWNER_LC/meshcentral:${{ github.ref_name }}-mongodb \ ghcr.io/$REPO_OWNER_LC/meshcentral:${{ github.ref_name }}-amd64-mongodb \ ghcr.io/$REPO_OWNER_LC/meshcentral:${{ github.ref_name }}-arm64-mongodb \ # postgresql docker buildx imagetools create \ -t ghcr.io/$REPO_OWNER_LC/meshcentral:${{ github.ref_name }}-postgresql \ ghcr.io/$REPO_OWNER_LC/meshcentral:${{ github.ref_name }}-amd64-postgresql \ ghcr.io/$REPO_OWNER_LC/meshcentral:${{ github.ref_name }}-arm64-postgresql \ # mariadb docker buildx imagetools create \ -t ghcr.io/$REPO_OWNER_LC/meshcentral:${{ github.ref_name }}-mariadb \ ghcr.io/$REPO_OWNER_LC/meshcentral:${{ github.ref_name }}-amd64-mariadb \ ghcr.io/$REPO_OWNER_LC/meshcentral:${{ github.ref_name }}-arm64-mariadb \ # all (no suffix) docker buildx imagetools create \ -t ghcr.io/$REPO_OWNER_LC/meshcentral:${{ github.ref_name }} \ ghcr.io/$REPO_OWNER_LC/meshcentral:${{ github.ref_name }}-amd64 \ ghcr.io/$REPO_OWNER_LC/meshcentral:${{ github.ref_name }}-arm64 \ # slim docker buildx imagetools create \ -t ghcr.io/$REPO_OWNER_LC/meshcentral:${{ github.ref_name }}-slim \ ghcr.io/$REPO_OWNER_LC/meshcentral:${{ github.ref_name }}-amd64-slim \ ghcr.io/$REPO_OWNER_LC/meshcentral:${{ github.ref_name }}-arm64-slim \ - name: Create and push 'latest' tags (releases only) if: github.event_name == 'release' run: | REPO_OWNER_LC="$(echo "${{ github.repository_owner }}" | tr '[:upper:]' '[:lower:]')" # latest-mongodb docker buildx imagetools create \ -t ghcr.io/$REPO_OWNER_LC/meshcentral:latest-mongodb \ ghcr.io/$REPO_OWNER_LC/meshcentral:${{ github.ref_name }}-amd64-mongodb \ ghcr.io/$REPO_OWNER_LC/meshcentral:${{ github.ref_name }}-arm64-mongodb \ # latest-postgresql docker buildx imagetools create \ -t ghcr.io/$REPO_OWNER_LC/meshcentral:latest-postgresql \ ghcr.io/$REPO_OWNER_LC/meshcentral:${{ github.ref_name }}-amd64-postgresql \ ghcr.io/$REPO_OWNER_LC/meshcentral:${{ github.ref_name }}-arm64-postgresql \ # latest-mariadb docker buildx imagetools create \ -t ghcr.io/$REPO_OWNER_LC/meshcentral:latest-mariadb \ ghcr.io/$REPO_OWNER_LC/meshcentral:${{ github.ref_name }}-amd64-mariadb \ ghcr.io/$REPO_OWNER_LC/meshcentral:${{ github.ref_name }}-arm64-mariadb \ # latest (all databases) docker buildx imagetools create \ -t ghcr.io/$REPO_OWNER_LC/meshcentral:latest \ ghcr.io/$REPO_OWNER_LC/meshcentral:${{ github.ref_name }}-amd64 \ ghcr.io/$REPO_OWNER_LC/meshcentral:${{ github.ref_name }}-arm64 \ # latest-slim docker buildx imagetools create \ -t ghcr.io/$REPO_OWNER_LC/meshcentral:latest-slim \ ghcr.io/$REPO_OWNER_LC/meshcentral:${{ github.ref_name }}-amd64-slim \ ghcr.io/$REPO_OWNER_LC/meshcentral:${{ github.ref_name }}-arm64-slim \