-
Notifications
You must be signed in to change notification settings - Fork 50
46 lines (37 loc) · 1.34 KB
/
Copy pathdocker.yml
File metadata and controls
46 lines (37 loc) · 1.34 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
name: Docker build & smoke test
on:
push:
branches: [main]
pull_request:
branches: [main]
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Build ML API image
run: docker build -t spam-ml-api:ci -f backend/Dockerfile.api backend
- name: Build Node backend image
run: docker build -t spam-node-backend:ci -f backend/Dockerfile.node backend
- name: Build frontend image
run: docker build -t spam-frontend:ci -f frontend/Dockerfile --build-arg VITE_API_URI=/predict frontend
- name: Start ML API container
run: docker run -d -p 5000:5000 -e INTERNAL_SECRET=test_secret_that_is_at_least_32_characters_long_for_ci -e FLASK_HOST=0.0.0.0 --name spam_ml_api_ci spam-ml-api:ci
- name: Smoke test - ML API responds on port 5000
run: |
for i in $(seq 1 15); do
if curl -sf http://localhost:5000/ -o /dev/null; then
echo "ML API is up"
exit 0
fi
sleep 2
done
echo "ML API did not respond on port 5000"
docker ps -a
docker inspect spam_ml_api_ci
docker logs spam_ml_api_ci
exit 1
- name: Stop ML API container
if: always()
run: docker stop spam_ml_api_ci || true