Skip to content

Commit 08b2290

Browse files
committed
fix: update workflow to check containers are running without healthcheck
1 parent aca6934 commit 08b2290

File tree

1 file changed

+7
-17
lines changed

1 file changed

+7
-17
lines changed

.github/workflows/docker-compose-test.yml

Lines changed: 7 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -22,33 +22,23 @@ jobs:
2222
curl -sSL https://github.com/prometheus/prometheus/releases/download/v2.48.0/prometheus-2.48.0.linux-amd64.tar.gz | tar -xz
2323
./prometheus-2.48.0.linux-amd64/promtool check config ./prometheus/config/prometheus.yml
2424
25-
- name: Build services
26-
run: docker compose build
27-
28-
- name: Prepare Prometheus folder
29-
run: |
30-
mkdir -p ./prometheus/data
31-
sudo chown -R 65534:65534 ./prometheus/data
32-
3325
- name: Start services
34-
run: docker compose up -d
35-
36-
- name: Wait for containers to initialize
37-
run: sleep 20
26+
run: |
27+
docker compose up -d --build
28+
sleep 30
3829
3930
- name: Check containers are running
4031
run: |
4132
set -e
4233
services=("prometheus" "grafana" "nginx" "alertmanager")
4334
for svc in "${services[@]}"; do
44-
status=$(docker inspect -f '{{.State.Health.Status}}' "$svc" 2>/dev/null || echo "unknown")
45-
if [[ "$status" == "healthy" || "$status" == "starting" ]]; then
46-
echo "✅ $svc container is running ($status)"
35+
if docker ps --filter "name=$svc" --format "table {{.Names}}\t{{.Status}}" | grep -q Up; then
36+
echo "$svc container is running"
4737
else
48-
echo "$svc container not healthy"
38+
echo "$svc container is not running"
4939
docker logs "$svc" || true
5040
exit 1
51-
fi
41+
fi
5242
done
5343
5444
- name: Stop services

0 commit comments

Comments
 (0)