Skip to content

Merge pull request #21 from AgoraIO-Conversational-AI/ci/nightly #8

Merge pull request #21 from AgoraIO-Conversational-AI/ci/nightly

Merge pull request #21 from AgoraIO-Conversational-AI/ci/nightly #8

Workflow file for this run

name: docker
on:
push:
branches: ["**"]
tags: ["v*"]
pull_request:
workflow_call:
permissions:
contents: read
packages: write
jobs:
docker:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: docker/setup-buildx-action@v3
- id: meta
uses: docker/metadata-action@v5
with:
images: ghcr.io/${{ github.repository }}
tags: |
type=sha
type=ref,event=pr
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
type=raw,value=latest,enable=${{ startsWith(github.ref, 'refs/tags/') }}
- name: Build (load locally, no push)
uses: docker/build-push-action@v6
with:
context: .
platforms: linux/amd64
load: true
push: false
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=gha
cache-to: type=gha,mode=max
- name: Smoke test
run: |
IMAGE=$(printf '%s\n' "${{ steps.meta.outputs.tags }}" | head -n1)
echo "Smoke-testing $IMAGE"
docker run -d --name smoke -p 8000:8000 \
-e AGORA_APP_ID=0123456789abcdef0123456789abcdef \
-e AGORA_APP_CERTIFICATE=fedcba9876543210fedcba9876543210 \
"$IMAGE"
set +e
fail=0
for url in http://localhost:8000/get_config; do
ok=""
for i in $(seq 1 40); do
if curl -fsS "$url" -o /dev/null; then ok=1; echo "OK $url"; break; fi
sleep 1
done
if [ -z "$ok" ]; then echo "FAIL $url"; fail=1; fi
done
if [ "$fail" -ne 0 ]; then docker logs smoke; fi
docker rm -f smoke
exit $fail
- name: Log in to GHCR
if: startsWith(github.ref, 'refs/tags/')
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Push tags
if: startsWith(github.ref, 'refs/tags/')
run: |
printf '%s\n' "${{ steps.meta.outputs.tags }}" | while read -r tag; do
[ -n "$tag" ] && docker push "$tag"
done