Add auto deploy workflow for ML API
This commit is contained in:
parent
e13c7ffd76
commit
4c803f2570
|
|
@ -0,0 +1,35 @@
|
|||
name: Auto Deploy HRISMP ML API
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
|
||||
jobs:
|
||||
deploy:
|
||||
runs-on: self-hosted
|
||||
|
||||
steps:
|
||||
- name: Deployment Logic HRISMP ML API
|
||||
run: |
|
||||
cd /www/wwwroot/joule/mp-hris-ml
|
||||
|
||||
OLD_COMMIT=$(git rev-parse HEAD)
|
||||
|
||||
git fetch --all
|
||||
git reset --hard origin/main
|
||||
|
||||
NEW_COMMIT=$(git rev-parse HEAD)
|
||||
|
||||
if [ "$OLD_COMMIT" != "$NEW_COMMIT" ]; then
|
||||
echo " Update detected. Rebuilding ML API..."
|
||||
docker compose down
|
||||
docker compose up -d --build
|
||||
docker image prune -f
|
||||
else
|
||||
echo "No changes detected. Skip rebuild."
|
||||
fi
|
||||
|
||||
echo "Checking ML API health..."
|
||||
sleep 5
|
||||
curl -f http://127.0.0.1:8002/health || exit 1
|
||||
Loading…
Reference in New Issue