Updaet to use official docker compose #59
Workflow file for this run
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: Python Face Registration & Recognition Test CI | |
on: | |
push: | |
branches: | |
- master | |
pull_request: | |
branches: | |
- master | |
jobs: | |
test: | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
os: [ubuntu-22.04] | |
python: ["3.9", "3.10"] | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v2 | |
- name: Set models cache | |
id: models-cache | |
uses: actions/cache@v2 | |
with: | |
path: app_docker_compose/app/triton_server/models | |
key: ${{ runner.os }}-models-${{ hashFiles('app_docker_compose/app/triton_server/models') }} | |
- name: Download models | |
id: download-models | |
# if: ${{ steps.models-cache.outputs.cache-hit != 'true' }} | |
run: | | |
pip install gdown | |
gdown 12zPEd0IgrEDJU3jcMj5EZWU0Yt7GKTRp | |
unzip -o models.zip -d app_docker_compose/app/triton_server | |
rm models.zip | |
- name: Remove unnecessary files | |
run: | | |
sudo rm -rf /usr/share/dotnet | |
sudo rm -rf /opt/ghc | |
sudo rm -rf "/usr/local/share/boost" | |
sudo rm -rf "$AGENT_TOOLSDIRECTORY" | |
- name: Verify cached models present | |
run: ls app_docker_compose/app/triton_server/models | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v2 | |
- name: Cache Docker layers | |
uses: actions/cache@v3 | |
with: | |
path: /tmp/.buildx-cache | |
key: ${{ runner.os }}-buildx-${{ github.sha }} | |
restore-keys: | | |
${{ runner.os }}-buildx- | |
- name: Install Docker Compose | |
run: | | |
sudo curl -L "https://github.com/docker/compose/releases/download/2.29.1/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose | |
sudo chmod +x /usr/local/bin/docker-compose | |
- name: Cache python modules | |
uses: actions/cache@v2 | |
with: | |
path: ~/.cache/pip | |
key: ${{ runner.os }}-pip-${{ hashFiles('app_docker_compose/**/requirements.txt') }} | |
restore-keys: | | |
${{ runner.os }}-pip- | |
- name: Install python dependencies | |
run: | | |
python -m pip install --upgrade pip | |
pip install --no-cache-dir -r app_docker_compose/requirements.txt | |
pip install --no-cache-dir -r app_docker_compose/tests/requirements.txt | |
- name: Free apt & pip cache | |
run: | | |
sudo apt-get clean | |
sudo apt-get autoremove -y | |
sudo rm -rf /var/lib/apt/lists/* | |
sudo rm -rf /root/.cache/pip | |
- name: Create .env file | |
working-directory: app_docker_compose | |
run: | | |
touch .env | |
echo DOWNLOAD_CACHE_PATH="app/.data" >> .env | |
echo DOWNLOAD_IMAGE_PATH="volumes/person_images" >> .env | |
echo API_SERVER_PORT=8080 >> .env | |
echo MILVUS_HOST=standalone >> .env | |
echo MILVUS_PORT=19530 >> .env | |
echo ATTU_PORT=3000 >> .env | |
echo MYSQL_HOST=mysql >> .env | |
echo MYSQL_PORT=3306 >> .env | |
echo MYSQL_USER=user >> .env | |
echo MYSQL_PASSWORD=pass >> .env | |
echo MYSQL_DATABASE=default >> .env | |
echo MYSQL_PERSON_TABLE=person >> .env | |
echo MYSQL_ROOT_PASSWORD=admin >> .env | |
echo PMA_GUI_PORT=8001 >> .env | |
echo PMA_HOST=mysql >> .env | |
echo PMA_PORT=3306 >> .env | |
echo PMA_USER=user >> .env | |
echo PMA_PASSWORD=pass >> .env | |
echo REDIS_HOST=redis-server >> .env | |
echo REDIS_PORT=6379 >> .env | |
- name: Add hosts to /etc/hosts | |
run: | | |
sudo echo "127.0.0.1 standalone" | sudo tee -a /etc/hosts | |
sudo echo "127.0.0.1 mysql" | sudo tee -a /etc/hosts | |
sudo echo "127.0.0.1 redis-server" | sudo tee -a /etc/hosts | |
- name: Build Docker Compose services | |
run: | | |
docker compose -f app_docker_compose/docker-compose.yml build | |
docker image prune -f | |
- name: Start Docker Compose & trt server services | |
run: | | |
mkdir -p app_docker_compose/volumes/person_images | |
set -o allexport && source app_docker_compose/.env && set +o allexport | |
docker compose -f app_docker_compose/docker-compose.yml up -d etcd minio standalone attu mysql mysql-admin redis-server | |
docker run -d --rm -p 8081:8081 --name uvicorn_trt_server_cont app_docker_compose_uvicorn_trt_server:latest tritonserver --model-store app/triton_server/models --allow-grpc=true --allow-http=false --grpc-port=8081 | |
sleep 5 | |
- name: Run PyTest | |
working-directory: app_docker_compose | |
run: | | |
pytest tests | |
- name: Stop Docker Compose services | |
run: docker compose -f app_docker_compose/docker-compose.yml down |