Skip to content

Commit

Permalink
Merge branch 'master' into load-testing-script
Browse files Browse the repository at this point in the history
  • Loading branch information
yashtandon113 authored Jul 4, 2024
2 parents 64494fa + 6f21263 commit f8383c0
Show file tree
Hide file tree
Showing 2 changed files with 94 additions and 0 deletions.
72 changes: 72 additions & 0 deletions .github/workflows/install-dockerfile-and-check-ssl.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
name: Docker Build and Test

on:
# [push]
workflow_dispatch:
schedule:
- cron: '0 0 */5 * *'

jobs:
build:
runs-on: self-hosted

steps:
- name: Checkout repository
uses: actions/checkout@v2

- name: Show current branch
run: echo "Current branch is ${{ github.event.inputs.branch_name }}"

- name: stop the AMS service
run: sudo systemctl stop antmedia

- name: Run Docker service
run: sudo systemctl restart docker

- name: Build Docker image
run: docker build -f docker/Dockerfile_Process --network=host -t antmediaserver --build-arg LicenseKey="${{ secrets.ENTERPRISE_LICENSE }}" .

- name: Run Docker container
run: docker run --restart=always -d --name antmedia --network=host -it antmediaserver

- name: Check if SSL is enabled or not
run: |
set -e
if docker exec antmedia curl -f https://${{ secrets.CI_SSL_TEST_DOMAIN }}:5443; then
echo "Endpoint is reachable."
exit 1
else
echo "Endpoint is not reachable, but continuing workflow."
fi
# - name: Clone branch
# run: |
# git clone --depth=1 -b ${{ github.event.inputs.branch_name }} https://github.com/ant-media/Ant-Media-Server.git || git clone --depth=1 https://github.com/ant-media/Ant-Media-Server.git

- name: Download enable_ssl.sh inside container
run: docker exec antmedia wget -O /usr/local/antmedia/enable_ssl.sh https://raw.githubusercontent.com/ant-media/Ant-Media-Server/master/src/main/server/enable_ssl.sh

# - name: Copy enable_ssl.sh from cloned branch to container
# run: docker cp Ant-Media-Server/src/main/server/enable_ssl.sh antmedia:/usr/local/antmedia/enable_ssl.sh

- name: Run enable_ssl.sh inside container
run: docker exec antmedia bash /usr/local/antmedia/enable_ssl.sh -d ${{ secrets.CI_SSL_TEST_DOMAIN }}

- name: Verify container is running
run: |
sleep 20
docker ps -f name=antmedia
if [ $(docker ps -f name=antmedia --format '{{.Names}}') != "antmedia" ]; then
echo "Container is not running"
exit 1
fi
- name: Test application
run: |
docker exec antmedia curl -f https://${{ secrets.CI_SSL_TEST_DOMAIN }}:5443
- name: Stop and remove container
if: ${{ always() }}
run: |
docker stop antmedia
docker rm antmedia
sudo systemctl start antmedia
22 changes: 22 additions & 0 deletions docker/Dockerfile_Process
Original file line number Diff line number Diff line change
@@ -1,11 +1,25 @@
#
# This docker file can be used in kubernetes.
# It accepts all cluster related parameters at run time.
# It means it's very easy to add new containers to the cluster
#
# Usage:
#
# * AntMediaServer: Specify the name of the Ant Media Server zip file to install that specify Ant Media Server version to the docker image
# --build-arg AntMediaServer='ant-media-server.zip'
#
# * LicenseKey: Set your license key to this variable to install the latest Ant Media Server automatically to the docker image without needing a zip file. If you use this LicenseKey variable, don't specify AntMediaServer variable (# --build-arg AntMediaServer='ant-media-server.zip')
# --build-arg LicenseKey='your-license-key'
#
# * InstallMediaPush: Set this variable to 'true' to enable headless Chrome on the server for recording and streaming web pages back to Ant Media Server.
# --build-arg InstallMediaPush='true'
#

FROM ubuntu:22.04

ARG AntMediaServer
ARG LicenseKey
ARG InstallMediaPush

ARG BranchName=master

Expand All @@ -30,6 +44,14 @@ RUN cd /home \
exit 1; \
fi

RUN if [ "true" = "$InstallMediaPush" ]; then \
echo "test"; \
echo "#!/bin/bash\n\$@" > /usr/bin/sudo; \
chmod +x /usr/bin/sudo; \
wget -O install_media-push-plugin.sh https://raw.githubusercontent.com/ant-media/Plugins/master/MediaPushPlugin/src/main/script/install_media-push-plugin.sh; \
bash ./install_media-push-plugin.sh; \
fi

#
# Options:
#
Expand Down

0 comments on commit f8383c0

Please sign in to comment.