- docker-compose services now pull from localhost:5000 instead of building locally - build-push.sh builds + pushes all 5 Node images to local registry - CI workflows get build-push job: test → build → push → deploy - Deploy becomes: docker compose pull && docker compose up -d - Eliminates silent git pull + stale Docker cache issues
44 lines
1.3 KiB
YAML
44 lines
1.3 KiB
YAML
name: CI — P5 Cost
|
|
on:
|
|
push:
|
|
branches: [main]
|
|
paths: ['products/05-aws-cost-anomaly/**']
|
|
pull_request:
|
|
paths: ['products/05-aws-cost-anomaly/**']
|
|
|
|
jobs:
|
|
test:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Checkout
|
|
run: |
|
|
git clone --depth=1 http://192.168.86.11:3005/jarvis/dd0c.git $GITHUB_WORKSPACE || true
|
|
cd $GITHUB_WORKSPACE
|
|
|
|
- name: Install deps
|
|
run: cd $GITHUB_WORKSPACE/products/05-aws-cost-anomaly && npm ci --include=dev
|
|
|
|
- name: Type check
|
|
run: cd $GITHUB_WORKSPACE/products/05-aws-cost-anomaly && ./node_modules/.bin/tsc --noEmit
|
|
|
|
- name: Test
|
|
run: cd $GITHUB_WORKSPACE/products/05-aws-cost-anomaly && npm test
|
|
|
|
build-push:
|
|
runs-on: ubuntu-latest
|
|
needs: test
|
|
if: github.ref == 'refs/heads/main'
|
|
steps:
|
|
- name: Checkout
|
|
run: git clone --depth=1 http://192.168.86.11:3005/jarvis/dd0c.git $GITHUB_WORKSPACE || true
|
|
- name: Build and push
|
|
run: |
|
|
cd $GITHUB_WORKSPACE/products
|
|
docker build -t localhost:5000/dd0c-cost:latest ./05-aws-cost-anomaly
|
|
docker push localhost:5000/dd0c-cost:latest
|
|
- name: Deploy
|
|
run: |
|
|
cd $GITHUB_WORKSPACE/products
|
|
docker compose pull cost
|
|
docker compose up -d cost
|