diff --git a/compose.yaml b/compose.yaml index 0356ee9..3ec9339 100644 --- a/compose.yaml +++ b/compose.yaml @@ -13,6 +13,12 @@ services: volumes: - app-data:/app/var/data - app-cache:/app/var/bootstrap-cache + healthcheck: + test: ["CMD-SHELL", "php -r 'exit(@fsockopen(\"127.0.0.1\", 9000) ? 0 : 1);'"] + interval: 10s + timeout: 3s + retries: 3 + start_period: 20s nginx: build: @@ -20,9 +26,16 @@ services: dockerfile: docker/Dockerfile target: web depends_on: - - app + app: + condition: service_healthy ports: - "${HTTP_PORT:-8080}:80" + healthcheck: + test: ["CMD-SHELL", "wget -q --spider http://127.0.0.1/ || exit 1"] + interval: 10s + timeout: 3s + retries: 3 + start_period: 20s volumes: app-data: diff --git a/tests/Docker/ComposeHealthcheckTest.php b/tests/Docker/ComposeHealthcheckTest.php new file mode 100644 index 0000000..651e776 --- /dev/null +++ b/tests/Docker/ComposeHealthcheckTest.php @@ -0,0 +1,45 @@ + ['condition' => 'service_healthy']], + $compose['services']['nginx']['depends_on'] ?? null + ); + } +}