You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
146 lines
4.2 KiB
146 lines
4.2 KiB
4 months ago
|
name: Publish Docker image to registries
|
||
1 year ago
|
|
||
1 year ago
|
on:
|
||
|
push:
|
||
1 year ago
|
branches:
|
||
1 year ago
|
- release-*
|
||
4 months ago
|
|
||
|
release:
|
||
|
types: [published]
|
||
|
|
||
1 year ago
|
workflow_dispatch:
|
||
4 months ago
|
inputs:
|
||
|
tag:
|
||
|
description: "Tag version to be used for Docker image"
|
||
|
required: true
|
||
|
default: "v3.8.0"
|
||
1 year ago
|
|
||
4 months ago
|
# env:
|
||
|
# GO_VERSION: "1.21"
|
||
1 year ago
|
|
||
1 year ago
|
jobs:
|
||
4 months ago
|
publish-docker-images:
|
||
1 year ago
|
runs-on: ubuntu-latest
|
||
|
steps:
|
||
4 months ago
|
- uses: actions/checkout@v4
|
||
4 months ago
|
with:
|
||
|
path: main-repo
|
||
|
|
||
1 year ago
|
- name: Set up QEMU
|
||
1 year ago
|
uses: docker/setup-qemu-action@v3
|
||
4 months ago
|
|
||
1 year ago
|
- name: Set up Docker Buildx
|
||
1 year ago
|
uses: docker/setup-buildx-action@v3
|
||
1 year ago
|
|
||
4 months ago
|
- name: Build and push Docker image
|
||
|
uses: docker/build-push-action@v5
|
||
1 year ago
|
with:
|
||
4 months ago
|
context: ./main-repo
|
||
|
load: true
|
||
|
tags: "openim/openim-server:local"
|
||
1 year ago
|
|
||
4 months ago
|
- name: Checkout compose repository
|
||
|
uses: actions/checkout@v4
|
||
1 year ago
|
with:
|
||
4 months ago
|
repository: "openimsdk/openim-docker"
|
||
|
path: "compose-repo"
|
||
1 year ago
|
|
||
4 months ago
|
- name: Get Internal IP Address
|
||
|
id: get-ip
|
||
|
run: |
|
||
|
IP=$(hostname -I | awk '{print $1}')
|
||
|
echo "The IP Address is: $IP"
|
||
|
echo "::set-output name=ip::$IP"
|
||
1 year ago
|
|
||
4 months ago
|
- name: Update .env to use the local image
|
||
|
run: |
|
||
|
sed -i 's|OPENIM_SERVER_IMAGE=.*|OPENIM_SERVER_IMAGE=openim/openim-server:local|' ${{ github.workspace }}/compose-repo/.env
|
||
|
sed -i 's|MINIO_EXTERNAL_ADDRESS=.*|MINIO_EXTERNAL_ADDRESS=http://${{ steps.get-ip.outputs.ip }}:10005|' ${{ github.workspace }}/compose-repo/.env
|
||
|
|
||
|
- name: Start services using Docker Compose
|
||
|
run: |
|
||
|
cd ${{ github.workspace }}/compose-repo
|
||
|
docker compose up -d
|
||
4 months ago
|
sleep 60
|
||
4 months ago
|
|
||
|
- 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
|
||
|
|
||
4 months ago
|
|
||
|
- name: Extract metadata for Docker # (tags, labels)
|
||
4 months ago
|
if: success()
|
||
|
id: meta
|
||
10 months ago
|
uses: docker/metadata-action@v5.5.1
|
||
1 year ago
|
with:
|
||
4 months ago
|
images: |
|
||
|
openim/openim-server
|
||
|
ghcr.io/openimsdk/openim-server
|
||
|
registry.cn-hangzhou.aliyuncs.com/openimsdk/openim-server
|
||
4 months ago
|
|
||
1 year ago
|
# generate Docker tags based on the following events/attributes
|
||
|
tags: |
|
||
12 months ago
|
type=ref,event=tag
|
||
1 year ago
|
type=schedule
|
||
|
type=ref,event=branch
|
||
|
type=ref,event=pr
|
||
|
type=semver,pattern={{version}}
|
||
1 year ago
|
type=semver,pattern=v{{version}}
|
||
1 year ago
|
type=semver,pattern={{major}}.{{minor}}
|
||
|
type=semver,pattern={{major}}
|
||
|
type=sha
|
||
1 year ago
|
|
||
4 months ago
|
- name: Log in to Docker Hub
|
||
|
uses: docker/login-action@v2
|
||
|
with:
|
||
|
username: ${{ secrets.DOCKER_USERNAME }}
|
||
|
password: ${{ secrets.DOCKER_PASSWORD }}
|
||
|
|
||
1 year ago
|
- name: Log in to GitHub Container Registry
|
||
4 months ago
|
uses: docker/login-action@v2
|
||
1 year ago
|
with:
|
||
|
registry: ghcr.io
|
||
1 year ago
|
username: ${{ github.repository_owner }}
|
||
1 year ago
|
password: ${{ secrets.GITHUB_TOKEN }}
|
||
|
|
||
4 months ago
|
- name: Log in to Aliyun Container Registry
|
||
|
uses: docker/login-action@v2
|
||
|
with:
|
||
|
registry: registry.cn-hangzhou.aliyuncs.com
|
||
|
username: ${{ secrets.ALIREGISTRY_USERNAME }}
|
||
|
password: ${{ secrets.ALIREGISTRY_TOKEN }}
|
||
|
|
||
4 months ago
|
- name: Build and push Docker images
|
||
1 year ago
|
uses: docker/build-push-action@v5
|
||
1 year ago
|
with:
|
||
4 months ago
|
context: ./main-repo
|
||
|
push: true
|
||
1 year ago
|
platforms: linux/amd64,linux/arm64
|
||
4 months ago
|
tags: ${{ steps.meta.outputs.tags }}
|
||
|
labels: ${{ steps.meta.outputs.labels }}
|