Docker compose extend
duplicating a Redis service in every docker-compose file, today I learned that compose configurations can be shared across file and projects.
// monorepo/docker-compose.yml
version: "3"
services:
redis:
image: redis:5.0.6
ports:
- 6379:6379
(...) // other shared dependencies
// monorepo/packages/my-service/docker-compose.yml
version: "3"
services:
redis:
extends:
file: ../../docker-compose.yml
service: redis
(...) // other service dependencies