Hello I have multiple projects that have there own dockerfiles and docker-compose.yml files. I am not too familiar on how I would setup the networking between these projects. So they could share the same databases and the project would be able to talk to on another. Does anyone have suggests?
Right now, In one of the projects I am just pulling in all the dockerfile into a docker-compose.yml and setting-up all the services I need from all the other projects in this yml file. I do not think this is ideal and there is a high level a coupling between the services.
version: "3"
services:
  db:
    image: mysql/mysql-server
    ports:
      - 3306:3306
  mongo: 
    image: mongo
    restart: always
  rails_app:
    build: 
        context: ${RAILS_APP_PATH}
        dockerfile: Dockerfile
    volumes:
      - ${RAILS_APP_PATH}:/application
    ports:
      - 4000:4000
    depends_on: 
      - db
      - mongo
    links: 
      - db
      - mongo
  frontend:
    build: 
      context: ${FRONTEND_PATH} 
    ports: 
        - ${EXPOSED_PORT}:${EXPOSED_PORT}
    depends_on:
      - go_services
    links:
      - go_services
  go_services:
    build: 
        context: . 
        dockerfile: Dockerfile
    ports: 
        - "8080:8080"
    depends_on: 
      - db
      - mongo
      - rails_app
    links: 
      - db
      - mongo
      - rails_app
 
     
    