How to centralize infrastructure docker for multiple repositories

I have multiple repositories that all depend on common infrastructure. Therefore there is a docker-compose.infrastructure.yml that spins up all those dependenencies.

Example:

version: '3.5'
services:

  seq:
    image: datalust/seq:latest
    container_name: seq
    ports:
      - "5341:80"
    environment:
      - ACCEPT_EULA=Y
    networks:
      - my-network

  couchbase:
    build:
      context: ./docker-compose/couchbase
      dockerfile: Dockerfile
    container_name: couchbase
    ports:
      - 8091:8091
      - 8092:8092
      - 8093:8093
      - 11210:11210
    environment:
      - USERNAME=**
      - PASSWORD=**
      - BUCKET=blah
    networks:
      - my-network

  localstack:
    build:
      context: ./docker-compose/localstack
      dockerfile: Dockerfile
    container_name: localstack
    environment:
      - SERVICES=s3,sqs
      - HOSTNAME=localstack
      - DEFAULT_REGION=eu-west-2
    ports:
      - "4572:4572"
      - "4576:4576"
      - "8080:8080"
    networks:
      - my-network
    volumes:
      - ./docker-compose/localstack/provision.sh:/docker-entrypoint-initaws.d/provision.sh

  eventstore:
    image: eventstore/eventstore:release-5.0.0
    container_name: 3ds2-eventstore
    environment:
      - EVENTSTORE_START_STANDARD_PROJECTIONS=TRUE
      - EVENTSTORE_RUN_PROJECTIONS=All
    ports:
      - "2113:2113"
      - "1113:1113"
    networks:
      - my-network

networks:
  my-network:
    name: my-network

The problem is that every repo contains the same docker-compose.infrastructure.yml and if there is an infrastructure change, then that means we have to do the same change on all the other repos.

I’m trying to see if there’s a way to centralize the docker-compose.infrastructure.yml either by hosting it somewhere and then getting all other repos to pull it down and run it.

From what I understand, it cannot be an image because that will lose the environment and port settings.

If there is an elegant way to centralize the infrastructure build for all other repos, please let me know how to do this.

Source: StackOverflow