version: "2.1" services: postgres: image: postgres:latest ports: - "5432:5432" volumes: - .:/data environment: - POSTGRES_DB=test - POSTGRES_USER=postgres - POSTGRES_PASSWORD=postgres healthcheck: test: ["CMD-SHELL", "pg_isready", "--username=postgres"] interval: 30s timeout: 30s retries: 5 command: ["-c", "shared_buffers=256MB"] migrations: links: - postgres depends_on: postgres: condition: service_healthy build: context: . dockerfile: migrations.Dockerfile environment: - DATABASE_URL=postgres://postgres:postgres@postgres:5432/test