api/tests/docker-smoke.sh
19 lines · 553 bytes
1#!/usr/bin/env bash
2# Builds the Docker image and checks the container serves the health route
3set -euo pipefail
4
5docker build -t awesome-privacy-api .
6cid=$(docker run -d -p 8787:8787 awesome-privacy-api)
7trap 'docker rm -f "${cid}" >/dev/null 2>&1 || true' EXIT
8
9for _ in $(seq 1 30); do
10 curl -fsS http://localhost:8787/v1/health >/dev/null 2>&1 && break
11 sleep 2
12done
13
14curl -fsS http://localhost:8787/v1/health | grep -q '"status":"ok"' || {
15 echo "❌ Docker health check failed"
16 docker logs "${cid}"
17 exit 1
18}
19echo "✅ Docker smoke passed"