diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index e7d0741..c20908c 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -25,22 +25,8 @@ jobs: - name: Checkout. uses: actions/checkout@v5 - - name: Docker version. - run: | - docker version - docker compose version - - name: Build and start containers. - run: docker compose up -d --build - - - name: Wait for readiness. - run: | - for i in {1..60}; do - if docker exec yii2-apache sh -lc "curl -ksS -o /dev/null -w '%{http_code}' https://localhost | grep -qE '200|302'"; then - echo "Service is ready"; exit 0; fi - sleep 2 - done - echo "Service not ready"; docker logs yii2-apache; exit 1 + run: docker compose up -d --build --wait - name: Codeception build. run: docker exec yii2-apache vendor/bin/codecept build diff --git a/CHANGELOG.md b/CHANGELOG.md index ebf166b..91dcfb4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -19,6 +19,7 @@ - Bug #180: Update paths to ignore in GitHub Actions workflow for pull requests and pushes (@terabytesoftw) - Bug #184: Update Docker commands and badge links in `README.md` for accurate workflow status (@terabytesoftw) - Bug #186: Rename steps for clarity in GitHub Actions workflow `build.yml` (@terabytesoftw) +- Bug #190: Simplify Docker workflow by removing unnecessary steps and adding healthcheck configuration (@terabytesoftw) ## 0.1.0 August 31, 2025 diff --git a/docker-compose.yml b/docker-compose.yml index dbd5a19..33061a4 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -16,6 +16,12 @@ services: TZ: "UTC" YII_DEBUG: "${YII_DEBUG:-false}" YII_ENV: "${YII_ENV:-prod}" + healthcheck: + test: ["CMD-SHELL", "curl -f http://localhost/ || exit 1"] + interval: 10s + timeout: 5s + retries: 5 + start_period: 25s ports: - '8080:80' - '8443:443'