diff --git a/docker-compose.yml b/docker-compose.yml index 7d7640672..9d3f1ebd2 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -12,6 +12,11 @@ services: - 5432:5432 volumes: - postgres_data:/var/lib/postgresql/data + healthcheck: + test: ["CMD-SHELL", "pg_isready -U ${POSTGRES_USER}"] + interval: 2s + timeout: 5s + retries: 20 app: build: @@ -27,11 +32,12 @@ services: ports: - 8000:8000 depends_on: - - db + db: + condition: service_healthy # <-- wait for DB to be ready links: - db volumes: - .:/app volumes: - postgres_data: \ No newline at end of file + postgres_data: