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 build
- docker-compose up -d - docker-compose up -d
script: script:
- docker-compose run --rm dbmate make wait
- docker-compose run --rm dbmate make test - docker-compose run --rm dbmate make test
- docker-compose run --rm dbmate make lint - docker-compose run --rm dbmate make lint
- docker build -t dbmate . - docker build -t dbmate .

View file

@ -21,6 +21,11 @@ test:
lint: lint:
gometalinter.v2 $(PACKAGES) gometalinter.v2 $(PACKAGES)
.PHONY: wait
wait:
dbmate -e MYSQL_URL wait
dbmate -e POSTGRESQL_URL wait
.PHONY: clean .PHONY: clean
clean: clean:
rm -rf dist rm -rf dist

View file

@ -5,19 +5,16 @@ services:
context: . context: .
target: build target: build
depends_on: depends_on:
mysql: - mysql
condition: service_healthy - postgres
postgres: environment:
condition: service_healthy MYSQL_URL: mysql://root:root@mysql/dbmate
POSTGRESQL_URL: postgres://postgres:postgres@postgres/dbmate?sslmode=disable
mysql: mysql:
image: mysql:5.7 image: mysql:5.7
environment: environment:
MYSQL_ROOT_PASSWORD: root MYSQL_ROOT_PASSWORD: root
healthcheck:
test: ["CMD", "mysqladmin", "status", "-proot"]
postgres: postgres:
image: postgres:9.6 image: postgres:9.6
healthcheck:
test: ["CMD", "pg_isready"]