Files
MeshCentral/.github/workflows/myothertest.yml
Simon Smith b0dc9eca69 fix delete digest
Signed-off-by: Simon Smith <simonsmith5521@gmail.com>
2025-10-26 11:49:51 +00:00

269 lines
8.8 KiB
YAML

# GitHub Actions workflow: Translate then build Docker images for multiple platforms
name: Translate and Multi-Platform Docker Build
on:
push:
branches: [testme-docker]
pull_request:
branches: [testme-docker]
jobs:
translate:
runs-on: ubuntu-latest
name: Run Translations
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up Node.js (LTS)
uses: actions/setup-node@v4
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@v4
with:
name: repo-with-translations
path: .
build-amd64:
runs-on: ubuntu-latest
needs: translate
name: Build Docker Image (linux/amd64)
steps:
- name: Download repo artifact
uses: actions/download-artifact@v4
with:
name: repo-with-translations
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Set up Node.js (LTS)
uses: actions/setup-node@v4
with:
node-version: lts/*
- 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)
run: |
REPO_OWNER_LC="$(echo "${{ github.repository_owner }}" | tr '[:upper:]' '[:lower:]')"
docker buildx build \
--platform linux/amd64 \
--build-arg INCLUDE_MONGODB_TOOLS=YES \
--build-arg INCLUDE_POSTGRESQL_TOOLS=YES \
--build-arg INCLUDE_MARIADB_TOOLS=YES \
--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 }}-amd64 \
--push \
.
build-arm64:
runs-on: ubuntu-latest
needs: translate
name: Build Docker Image (linux/arm64)
steps:
- name: Download repo artifact
uses: actions/download-artifact@v4
with:
name: repo-with-translations
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Set up Node.js (LTS)
uses: actions/setup-node@v4
with:
node-version: lts/*
- 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)
run: |
REPO_OWNER_LC="$(echo "${{ github.repository_owner }}" | tr '[:upper:]' '[:lower:]')"
docker buildx build \
--platform linux/arm64 \
--build-arg INCLUDE_MONGODB_TOOLS=YES \
--build-arg INCLUDE_POSTGRESQL_TOOLS=YES \
--build-arg INCLUDE_MARIADB_TOOLS=YES \
--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 }}-arm64 \
--push \
.
build-armv7:
runs-on: ubuntu-latest
needs: translate
name: Build Docker Image (linux/arm/v7)
steps:
- name: Download repo artifact
uses: actions/download-artifact@v4
with:
name: repo-with-translations
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Set up Node.js (LTS)
uses: actions/setup-node@v4
with:
node-version: lts/*
- 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 (arm/v7)
run: |
REPO_OWNER_LC="$(echo "${{ github.repository_owner }}" | tr '[:upper:]' '[:lower:]')"
docker buildx build \
--platform linux/arm/v7 \
--build-arg INCLUDE_MONGODB_TOOLS=YES \
--build-arg INCLUDE_POSTGRESQL_TOOLS=YES \
--build-arg INCLUDE_MARIADB_TOOLS=YES \
--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 }}-armv7 \
--push \
.
build-armv6:
runs-on: ubuntu-latest
needs: translate
name: Build Docker Image (linux/arm/v6)
steps:
- name: Download repo artifact
uses: actions/download-artifact@v4
with:
name: repo-with-translations
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Set up Node.js (LTS)
uses: actions/setup-node@v4
with:
node-version: lts/*
- 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 (arm/v6)
run: |
REPO_OWNER_LC="$(echo "${{ github.repository_owner }}" | tr '[:upper:]' '[:lower:]')"
docker buildx build \
--platform linux/arm/v6 \
--build-arg INCLUDE_MONGODB_TOOLS=YES \
--build-arg INCLUDE_POSTGRESQL_TOOLS=YES \
--build-arg INCLUDE_MARIADB_TOOLS=YES \
--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 }}-armv6 \
--push \
.
merge-manifest:
runs-on: ubuntu-latest
needs: [build-amd64, build-arm64, build-armv7, build-armv6]
name: Create and Push Multi-Arch Manifest
steps:
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- 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 manifest
run: |
REPO_OWNER_LC="$(echo "${{ github.repository_owner }}" | tr '[:upper:]' '[:lower:]')"
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 \
ghcr.io/$REPO_OWNER_LC/meshcentral:${{ github.ref_name }}-armv7 \
ghcr.io/$REPO_OWNER_LC/meshcentral:${{ github.ref_name }}-armv6
- name: Delete architecture-specific tags
run: |
REPO_OWNER_LC="$(echo "${{ github.repository_owner }}" | tr '[:upper:]' '[:lower:]')"
ghcr_repo=ghcr.io/$REPO_OWNER_LC/meshcentral
for arch in amd64 arm64 armv7 armv6; do
echo "Deleting $ghcr_repo:${{ github.ref_name }}-$arch ..."
digest=$(docker buildx imagetools inspect $ghcr_repo:${{ github.ref_name }}-$arch | grep '^Digest:' | awk '{print $2}')
if [ -n "$digest" ]; then
curl -s -X DELETE -H "Authorization: Bearer ${{ secrets.MY_TOKEN || secrets.GITHUB_TOKEN }}" \
"https://ghcr.io/v2/$REPO_OWNER_LC/meshcentral/manifests/$digest"
fi
done
env:
DOCKER_CLI_EXPERIMENTAL: enabled