Sync docker and ECR repo #1244
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: Sync docker and ECR repo | |
on: | |
workflow_dispatch: | |
inputs: | |
mode: | |
description: 'version string like 0.27.0, default is nightly' | |
required: true | |
default: 'nightly' | |
schedule: | |
- cron: '0 14 * * *' | |
jobs: | |
create-aarch64-runner: | |
runs-on: [ self-hosted, scheduler ] | |
steps: | |
- name: Create new Graviton instance | |
id: create_aarch64 | |
run: | | |
cd /home/ubuntu/djl_benchmark_script/scripts | |
token=$( curl -X POST -H "Authorization: token ${{ secrets.ACTION_RUNNER_PERSONAL_TOKEN }}" \ | |
https://api.github.com/repos/deepjavalibrary/djl-serving/actions/runners/registration-token \ | |
--fail \ | |
| jq '.token' | tr -d '"' ) | |
./start_instance.sh action_graviton $token djl-serving | |
outputs: | |
aarch64_instance_id: ${{ steps.create_aarch64.outputs.action_graviton_instance_id }} | |
nightly-aarch64: | |
runs-on: [ self-hosted, aarch64 ] | |
timeout-minutes: 60 | |
needs: create-aarch64-runner | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Clean docker env | |
working-directory: serving/docker | |
run: | | |
yes | docker system prune -a --volumes | |
- name: Set up Python3 | |
uses: actions/setup-python@v5 | |
with: | |
python-version: '3.10.x' | |
- name: Install pip dependencies | |
run: | | |
python -m pip install --upgrade pip | |
pip install awscli | |
- name: Pull and sync nightly docker image | |
working-directory: serving/docker | |
run: | | |
version=${{ github.event.inputs.mode }} | |
[ -z "$version" ] && version="nightly" | |
repo="125045733377.dkr.ecr.us-east-1.amazonaws.com" | |
aws ecr get-login-password --region us-east-1 | docker login --username AWS --password-stdin $repo | |
./scripts/pull_and_retag.sh $version $repo | |
- name: Clean docker env | |
working-directory: serving/docker | |
run: | | |
yes | docker system prune -a --volumes | |
stop-aarch64-runner: | |
if: always() | |
runs-on: [ self-hosted, scheduler ] | |
needs: [nightly-aarch64, create-aarch64-runner] | |
steps: | |
- name: Stop all instances | |
run: | | |
cd /home/ubuntu/djl_benchmark_script/scripts | |
instance_id=${{ needs.create-aarch64-runner.outputs.aarch64_instance_id }} | |
./stop_instance.sh $instance_id |