Merge branch 'master' into add_terraform #288
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: CI/CD for Docker Images - Ant Media Server (Ubuntu & Rocky Linux) | |
on: [push] | |
jobs: | |
ams_ubuntu_docker_test: | |
runs-on: ubuntu-latest | |
env: | |
BRANCH_NAME: ${{ github.ref_name }} | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
- name: Download the latest version of Ant Media Server | |
run: curl -L -o ant-media-server-community.zip $(curl -s https://api.github.com/repos/ant-media/Ant-Media-Server/releases/latest | grep "browser_download_url" | cut -d '"' -f 4) | |
- name: Download Dockerfile | |
run: wget --quiet https://raw.githubusercontent.com/ant-media/Scripts/$BRANCH_NAME/docker/Dockerfile_Process -O Dockerfile | |
- name: Build Docker image | |
run: docker build --network=host -t antmediaserver:latest --build-arg AntMediaServer=ant-media-server-community.zip --build-arg BranchName=$BRANCH_NAME . | |
- name: Run the image | |
run: docker run -d -p 5080:5080 --name antmediaserver antmediaserver | |
- name: Check Ant Media Server health with a timeout | |
run: | | |
timeout=120 | |
start_time=$(date +%s) | |
until wget http://localhost:5080 -O index.html; do | |
current_time=$(date +%s) | |
elapsed_time=$((current_time - start_time)) | |
if [ $elapsed_time -gt $timeout ]; then | |
echo "Timeout reached. Ant Media Server did not start within $timeout seconds." | |
exit 1 | |
fi | |
echo "Waiting for Ant Media Server to start..." | |
sleep 10 | |
done | |
- name: Stop and remove the container | |
run: docker stop antmediaserver && docker rm antmediaserver | |
ams_rockylinux_docker_test: | |
runs-on: ubuntu-latest | |
env: | |
BRANCH_NAME: ${{ github.ref_name }} | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
- name: Download the latest version of Ant Media Server | |
run: curl -L -o ant-media-server-community.zip $(curl -s https://api.github.com/repos/ant-media/Ant-Media-Server/releases/latest | grep "browser_download_url" | cut -d '"' -f 4) | |
- name: Download Dockerfile | |
run: | | |
echo "Building Docker image with branch: $BRANCH_NAME" | |
wget --quiet https://raw.githubusercontent.com/ant-media/Scripts/$BRANCH_NAME/docker/Dockerfile_RockyLinux -O Dockerfile | |
- name: Build Docker image | |
run: | | |
echo "Building Docker image with branch: $BRANCH_NAME" | |
docker build --network=host -t antmediaserver:latest --build-arg AntMediaServer=ant-media-server-community.zip --build-arg BranchName=$BRANCH_NAME . | |
- name: Run the image | |
run: docker run -d -p 5080:5080 --name antmediaserver antmediaserver | |
- name: Check Ant Media Server health with a timeout | |
run: | | |
timeout=120 | |
start_time=$(date +%s) | |
until wget http://localhost:5080 -O index.html; do | |
current_time=$(date +%s) | |
elapsed_time=$((current_time - start_time)) | |
if [ $elapsed_time -gt $timeout ]; then | |
echo "Timeout reached. Ant Media Server did not start within $timeout seconds." | |
exit 1 | |
fi | |
echo "Waiting for Ant Media Server to start..." | |
sleep 10 | |
done | |
- name: Stop and remove the container | |
run: docker stop antmediaserver && docker rm antmediaserver |