feat: create README.md (#109) #426
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Test Docker Compose | |
on: | |
push: | |
branches: | |
- main | |
pull_request: | |
branches: | |
- main | |
jobs: | |
test-docker-compose: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
- name: Set up Docker | |
uses: docker/setup-buildx-action@v2 | |
- name: Install Docker Compose | |
run: | | |
sudo curl -L "https://github.com/docker/compose/releases/download/v2.18.1/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose | |
sudo chmod +x /usr/local/bin/docker-compose | |
docker-compose --version # Verify installation | |
- name: Build and start Docker Compose services | |
run: | | |
docker-compose up --build -d | |
- name: Wait for all services to be healthy | |
run: | | |
services=("db" "api" "frontend") | |
for i in {1..10}; do | |
all_healthy=true | |
for service in "${services[@]}"; do | |
status=$(docker inspect --format='{{.State.Health.Status}}' jobesta-$service) | |
if [ "$status" != "healthy" ]; then | |
echo "Service $service is not healthy. Current status: $status"; | |
echo "Detailed information for $service:"; | |
docker inspect jobesta-$service --format='{{json .State.Health}}' | |
all_healthy=false | |
fi | |
done | |
if [ "$all_healthy" == "true" ]; then | |
echo "All services are healthy"; | |
break | |
else | |
echo "Waiting for all services to be healthy..."; | |
sleep 5 | |
fi | |
done | |
if [ "$all_healthy" != "true" ]; then | |
echo "Not all services are healthy after waiting."; | |
exit 1 | |
fi | |
shell: bash | |
- name: Verify services are running | |
run: docker-compose ps | |
- name: Clean up Docker Compose | |
if: always() | |
run: docker-compose down --volumes |