Skip to content

Instantly share code, notes, and snippets.

@kerren
Last active August 7, 2019 11:44
Show Gist options
  • Save kerren/40477bea0fea2c47cdf0798a17cc4f9f to your computer and use it in GitHub Desktop.
Save kerren/40477bea0fea2c47cdf0798a17cc4f9f to your computer and use it in GitHub Desktop.
The Docker Compose file that waits for migration
version: '3.6'
services:
database:
image: postgres
environment:
- POSTGRES_PASSWORD=testing
- POSTGRES_USER=testing
- POSTGRES_DB=testing
ports:
- 5432
expose:
- 5432
networks:
- testing-network
redis:
image: redis
ports:
- 6379
expose:
- 6379
networks:
- testing-network
migration:
build:
context: ../../../backend/
dockerfile: $PWD/Dockerfile.migration
ports:
- 3000
environment:
- DB_USERNAME=testing
- DB_PASSWORD=testing
- DB_DATABASE=testing
- DB_HOST=database
- REDIS_HOST=redis
- WAIT_HOSTS: database:3306, redis:6379
- WAIT_HOSTS_TIMEOUT: 300
depends_on:
- database
- redis
networks:
- testing-network
backend:
build:
context: ../../../backend/
dockerfile: $PWD/Dockerfile
ports:
- 3000
environment:
- DB_USERNAME=testing
- DB_PASSWORD=testing
- DB_DATABASE=testing
- DB_HOST=database
- REDIS_HOST=redis
- WAIT_HOSTS: migration:3000
- WAIT_HOSTS_TIMEOUT: 300
depends_on:
- migration
networks:
- testing-network
networks:
testing-network
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment