I have and app which is actually composed of 2 apps, a .NET Core backend (API only) with PostgreSQL and a Vue.js app (front-end).
My goal is to dockerize them and deploy the built images to DigitalOcean and serve them through nginx.
I’ve read a lot of stuff and from what I understand I need to add a Dockerfile configuring each project’s (API and front-end) build/run processes and create a docker-compose file with 4 services: the 2 apps, postgres and nginx.
With this I should be able to “up” the docker-compose and run everything locally.
Now my question is, how do I deploy this to DigitalOcean, with the following considerations:
- It’s a commercial app, so the code should not be public;
- The source should be built locally and the build image should then be deployed (instead of pulling the source and building it in the server);
- The server should up the whole docker-compose configuration;
- The back-end and front-end apps will be independent, so I should be able to, for example, just deploy a new version of the front-end.
I’ve spent the whole day reading tutorials and documentation online and the options I found didn’t seem to fit what I need:
Option 1: Install Dokku on the droplet and push the apps there, but it seems not to support a docker-compose file. Maybe I can just manually create a docker-compose file in the server, use Dokku to deploy each image and then go to the server and restart the docker-compose?
Option 2: Use docker hub registry. This only stores the compiled code (not the source), right? But then do I have to purchase private repositories? Do I need one repository for each app? Does it support the docker-compose file? It seems to be a bit overkill to have to send my built image to a registry just to have it then sent to the server.
What would be the simplest way to handle this?