1

I'm trying to create a website using SvelteKit and reached a point where I need to add a CMS. I decided to opt for PayloadCMS, but that isn't really relevant. Currently my project is contained in a single git repo where I have a Dockerfile which builds both a production and development version of my app.

Then I have a compose.dev.yml file that runs the development version locally and Google Cloud Build configurations to build and run my application on Cloud Run. Preferably I'd like to avoid having a monorepo, as that would add some complexity to the Google Cloud side of things, so I'd like to know if there is a good way to add another repo for PayloadCMS add a Dockerfile in it and also have a way to start the development compose file for both projects in one place.

I looked at using a third repo with git submodules, but that seems to add more problems than it solves.

Edit: Seems like I didn't really ask a clear question. What I'm asking is if there is a way to have two or more repositories, that are deployed using a single docker-compose file, that is version-controlled somewhere. I think git submodules can be used, but everywhere I read how it's a bad solution. What other options do I have and what would be considered "best practice"?

marc_s
  • 732,580
  • 175
  • 1,330
  • 1,459
  • Is there a way? Yes. Do you have a more specific question? – Code-Apprentice Apr 04 '23 at 05:15
  • @Code-Apprentice Yes how can I have multiple repos and also be able to start them with a single docker-compose file, that is version-controlled? The only way I found is using git submodules, but it seems like that's not a good solution. What are my other options? – Mihail Mihov Apr 04 '23 at 06:02
  • Is this for production or development environment? Or both? – Code-Apprentice Apr 04 '23 at 07:22
  • 1
    @Code-Apprentice This is for development only, production is handled by Google Cloud Build and Run and the cloudbuild.yaml configurations. I just need a convenient way for developers to test the frontend and CMS locally – Mihail Mihov Apr 04 '23 at 08:14

1 Answers1

0

The compose.yaml file can have multiple service's defined. Each service can have a corresponding Dockerfile. The ADD command in each Dockerfile can pull from a repository. So, one Dockerfile can pull from repoA and a different Dockerfile can pull from repoB.

https://docs.docker.com/engine/reference/builder/#add

Ronnie Royston
  • 16,778
  • 6
  • 77
  • 91