From 767399e81cd6e76c21af665d7088c3554a269689 Mon Sep 17 00:00:00 2001 From: Brian Kroth Date: Mon, 30 Sep 2024 18:51:12 +0000 Subject: [PATCH] Adding health check to sqlserver docker-compose and make it start 5 seconds after launching the container --- .github/workflows/maven.yml | 1 + docker/sqlserver-latest/docker-compose.yml | 6 ++++++ 2 files changed, 7 insertions(+) diff --git a/.github/workflows/maven.yml b/.github/workflows/maven.yml index 0a36b54d5..392529e65 100644 --- a/.github/workflows/maven.yml +++ b/.github/workflows/maven.yml @@ -639,6 +639,7 @@ jobs: --health-interval 10s --health-timeout 5s --health-retries 5 + --health-start-period 5s ports: - 1433:1433 steps: diff --git a/docker/sqlserver-latest/docker-compose.yml b/docker/sqlserver-latest/docker-compose.yml index 513541373..5b5f99863 100644 --- a/docker/sqlserver-latest/docker-compose.yml +++ b/docker/sqlserver-latest/docker-compose.yml @@ -6,6 +6,12 @@ services: container_name: sqlserver hostname: sqlserver image: mcr.microsoft.com/mssql/server:latest + healthcheck: + test: ["CMD", "/opt/mssql-tools/bin/sqlcmd", "-S", "localhost", "-U", "sa", "-P", "SApassword1", "-b", "-Q", "SELECT 1;"] + interval: 10s + timeout: 5s + retries: 5 + start_period: 5s environment: ACCEPT_EULA: Y SA_PASSWORD: SApassword1