|
|
@ -25,11 +25,11 @@ jobs:
|
|
|
|
with:
|
|
|
|
with:
|
|
|
|
path: main-repo
|
|
|
|
path: main-repo
|
|
|
|
|
|
|
|
|
|
|
|
- name: Set up QEMU
|
|
|
|
# - name: Set up QEMU
|
|
|
|
uses: docker/setup-qemu-action@v3
|
|
|
|
# uses: docker/setup-qemu-action@v3.3.0
|
|
|
|
|
|
|
|
|
|
|
|
- name: Set up Docker Buildx
|
|
|
|
- name: Set up Docker Buildx
|
|
|
|
uses: docker/setup-buildx-action@v3
|
|
|
|
uses: docker/setup-buildx-action@v3.8.0
|
|
|
|
|
|
|
|
|
|
|
|
- name: Build Docker image
|
|
|
|
- name: Build Docker image
|
|
|
|
id: build
|
|
|
|
id: build
|
|
|
@ -38,11 +38,8 @@ jobs:
|
|
|
|
context: ./main-repo
|
|
|
|
context: ./main-repo
|
|
|
|
load: true
|
|
|
|
load: true
|
|
|
|
tags: "openim/openim-server:local"
|
|
|
|
tags: "openim/openim-server:local"
|
|
|
|
cache-from: type=gha
|
|
|
|
cache-from: type=gha,scope=build
|
|
|
|
cache-to: type=gha,mode=max
|
|
|
|
cache-to: type=gha,mode=max,scope=build
|
|
|
|
|
|
|
|
|
|
|
|
- name: Save Docker image to file
|
|
|
|
|
|
|
|
run: docker save -o image.tar openim/openim-server:local
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
- name: Checkout compose repository
|
|
|
|
- name: Checkout compose repository
|
|
|
|
uses: actions/checkout@v4
|
|
|
|
uses: actions/checkout@v4
|
|
|
@ -66,43 +63,12 @@ jobs:
|
|
|
|
run: |
|
|
|
|
run: |
|
|
|
|
cd ${{ github.workspace }}/compose-repo
|
|
|
|
cd ${{ github.workspace }}/compose-repo
|
|
|
|
docker compose up -d
|
|
|
|
docker compose up -d
|
|
|
|
sleep 60
|
|
|
|
|
|
|
|
|
|
|
|
docker compose ps
|
|
|
|
# - name: Check openim-server health
|
|
|
|
|
|
|
|
# run: |
|
|
|
|
|
|
|
|
# timeout=300
|
|
|
|
|
|
|
|
# interval=30
|
|
|
|
|
|
|
|
# elapsed=0
|
|
|
|
|
|
|
|
# while [[ $elapsed -le $timeout ]]; do
|
|
|
|
|
|
|
|
# if ! docker exec openim-server mage check; then
|
|
|
|
|
|
|
|
# echo "openim-server is not ready, waiting..."
|
|
|
|
|
|
|
|
# sleep $interval
|
|
|
|
|
|
|
|
# elapsed=$(($elapsed + $interval))
|
|
|
|
|
|
|
|
# else
|
|
|
|
|
|
|
|
# echo "Health check successful"
|
|
|
|
|
|
|
|
# exit 0
|
|
|
|
|
|
|
|
# fi
|
|
|
|
|
|
|
|
# done
|
|
|
|
|
|
|
|
# echo "Health check failed after 5 minutes"
|
|
|
|
|
|
|
|
# exit 1
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# - name: Check openim-chat health
|
|
|
|
|
|
|
|
# if: success()
|
|
|
|
|
|
|
|
# run: |
|
|
|
|
|
|
|
|
# if ! docker exec openim-chat mage check; then
|
|
|
|
|
|
|
|
# echo "openim-chat check failed"
|
|
|
|
|
|
|
|
# exit 1
|
|
|
|
|
|
|
|
# else
|
|
|
|
|
|
|
|
# echo "Health check successful"
|
|
|
|
|
|
|
|
# exit 0
|
|
|
|
|
|
|
|
# fi
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
- name: Load Docker image from file
|
|
|
|
|
|
|
|
run: docker load -i image.tar
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
- name: Extract metadata for Docker (tags, labels)
|
|
|
|
- name: Extract metadata for Docker (tags, labels)
|
|
|
|
id: meta
|
|
|
|
id: meta
|
|
|
|
uses: docker/metadata-action@v5.5.1
|
|
|
|
uses: docker/metadata-action@v5.6.0
|
|
|
|
with:
|
|
|
|
with:
|
|
|
|
images: |
|
|
|
|
images: |
|
|
|
|
openim/openim-server
|
|
|
|
openim/openim-server
|
|
|
@ -112,29 +78,27 @@ jobs:
|
|
|
|
type=ref,event=tag
|
|
|
|
type=ref,event=tag
|
|
|
|
type=schedule
|
|
|
|
type=schedule
|
|
|
|
type=ref,event=branch
|
|
|
|
type=ref,event=branch
|
|
|
|
type=semver,pattern={{version}}
|
|
|
|
# type=semver,pattern={{version}}
|
|
|
|
type=semver,pattern=v{{version}}
|
|
|
|
type=semver,pattern=v{{version}}
|
|
|
|
type=semver,pattern={{major}}.{{minor}}
|
|
|
|
|
|
|
|
type=semver,pattern={{major}}
|
|
|
|
|
|
|
|
type=semver,pattern=release-{{raw}}
|
|
|
|
type=semver,pattern=release-{{raw}}
|
|
|
|
type=sha
|
|
|
|
type=sha
|
|
|
|
type=raw,value=${{ github.event.inputs.tag }}
|
|
|
|
type=raw,value=${{ github.event.inputs.tag }}
|
|
|
|
|
|
|
|
|
|
|
|
- name: Log in to Docker Hub
|
|
|
|
- name: Log in to Docker Hub
|
|
|
|
uses: docker/login-action@v2
|
|
|
|
uses: docker/login-action@v3.3.0
|
|
|
|
with:
|
|
|
|
with:
|
|
|
|
username: ${{ secrets.DOCKER_USERNAME }}
|
|
|
|
username: ${{ secrets.DOCKER_USERNAME }}
|
|
|
|
password: ${{ secrets.DOCKER_PASSWORD }}
|
|
|
|
password: ${{ secrets.DOCKER_PASSWORD }}
|
|
|
|
|
|
|
|
|
|
|
|
- name: Log in to GitHub Container Registry
|
|
|
|
- name: Log in to GitHub Container Registry
|
|
|
|
uses: docker/login-action@v2
|
|
|
|
uses: docker/login-action@v3.3.0
|
|
|
|
with:
|
|
|
|
with:
|
|
|
|
registry: ghcr.io
|
|
|
|
registry: ghcr.io
|
|
|
|
username: ${{ github.repository_owner }}
|
|
|
|
username: ${{ github.repository_owner }}
|
|
|
|
password: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
password: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
|
|
|
|
|
|
|
|
- name: Log in to Aliyun Container Registry
|
|
|
|
- name: Log in to Aliyun Container Registry
|
|
|
|
uses: docker/login-action@v2
|
|
|
|
uses: docker/login-action@v3.3.0
|
|
|
|
with:
|
|
|
|
with:
|
|
|
|
registry: registry.cn-hangzhou.aliyuncs.com
|
|
|
|
registry: registry.cn-hangzhou.aliyuncs.com
|
|
|
|
username: ${{ secrets.ALIREGISTRY_USERNAME }}
|
|
|
|
username: ${{ secrets.ALIREGISTRY_USERNAME }}
|
|
|
@ -148,3 +112,28 @@ jobs:
|
|
|
|
platforms: linux/amd64,linux/arm64
|
|
|
|
platforms: linux/amd64,linux/arm64
|
|
|
|
tags: ${{ steps.meta.outputs.tags }}
|
|
|
|
tags: ${{ steps.meta.outputs.tags }}
|
|
|
|
labels: ${{ steps.meta.outputs.labels }}
|
|
|
|
labels: ${{ steps.meta.outputs.labels }}
|
|
|
|
|
|
|
|
cache-from: type=gha,scope=build
|
|
|
|
|
|
|
|
cache-to: type=gha,mode=max,scope=build
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
- name: Verify multi-platform support
|
|
|
|
|
|
|
|
run: |
|
|
|
|
|
|
|
|
images=("openim/openim-server" "ghcr.io/openimsdk/openim-server" "registry.cn-hangzhou.aliyuncs.com/openimsdk/openim-server")
|
|
|
|
|
|
|
|
for image in "${images[@]}"; do
|
|
|
|
|
|
|
|
for tag in $(echo "${{ steps.meta.outputs.tags }}" | tr ',' '\n'); do
|
|
|
|
|
|
|
|
manifest=$(docker manifest inspect "$image:$tag" || echo "error")
|
|
|
|
|
|
|
|
if [[ "$manifest" == "error" ]]; then
|
|
|
|
|
|
|
|
echo "Manifest not found for $image:$tag"
|
|
|
|
|
|
|
|
exit 1
|
|
|
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
amd64_found=$(echo "$manifest" | jq '.manifests[] | select(.platform.architecture == "amd64")')
|
|
|
|
|
|
|
|
arm64_found=$(echo "$manifest" | jq '.manifests[] | select(.platform.architecture == "arm64")')
|
|
|
|
|
|
|
|
if [[ -z "$amd64_found" ]]; then
|
|
|
|
|
|
|
|
echo "Multi-platform support check failed for $image:$tag - missing amd64"
|
|
|
|
|
|
|
|
exit 1
|
|
|
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
if [[ -z "$arm64_found" ]]; then
|
|
|
|
|
|
|
|
echo "Multi-platform support check failed for $image:$tag - missing arm64"
|
|
|
|
|
|
|
|
exit 1
|
|
|
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
done
|
|
|
|
|
|
|
|
done
|
|
|
|