From c5afa3696279529acbfd5540147b422b872ac9e2 Mon Sep 17 00:00:00 2001 From: Adrian Macneil Date: Sun, 15 Apr 2018 20:34:19 -0700 Subject: [PATCH] Replace docker-compose healthchecks with wait command (#37) --- .travis.yml | 1 + Makefile | 5 +++++ docker-compose.yml | 13 +++++-------- 3 files changed, 11 insertions(+), 8 deletions(-) diff --git a/.travis.yml b/.travis.yml index 58cb73f..f9ee0f6 100644 --- a/.travis.yml +++ b/.travis.yml @@ -9,6 +9,7 @@ install: - docker-compose build - docker-compose up -d script: + - docker-compose run --rm dbmate make wait - docker-compose run --rm dbmate make test - docker-compose run --rm dbmate make lint - docker build -t dbmate . diff --git a/Makefile b/Makefile index be77f49..b62b5a0 100644 --- a/Makefile +++ b/Makefile @@ -21,6 +21,11 @@ test: lint: gometalinter.v2 $(PACKAGES) +.PHONY: wait +wait: + dbmate -e MYSQL_URL wait + dbmate -e POSTGRESQL_URL wait + .PHONY: clean clean: rm -rf dist diff --git a/docker-compose.yml b/docker-compose.yml index 3996c28..8e7bb19 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -5,19 +5,16 @@ services: context: . target: build depends_on: - mysql: - condition: service_healthy - postgres: - condition: service_healthy + - mysql + - postgres + environment: + MYSQL_URL: mysql://root:root@mysql/dbmate + POSTGRESQL_URL: postgres://postgres:postgres@postgres/dbmate?sslmode=disable mysql: image: mysql:5.7 environment: MYSQL_ROOT_PASSWORD: root - healthcheck: - test: ["CMD", "mysqladmin", "status", "-proot"] postgres: image: postgres:9.6 - healthcheck: - test: ["CMD", "pg_isready"]