Replace docker-compose healthchecks with wait command (#37)

This commit is contained in:
Adrian Macneil 2018-04-15 20:34:19 -07:00 committed by GitHub
parent ee3162c34c
commit c5afa36962
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 11 additions and 8 deletions

View file

@ -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 .

View file

@ -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

View file

@ -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"]