I need to deploy my Docker Compose project, but I’m unsure of the correct approach.
The docker-compose.yml file contains several services:
- Frontend: Next.js
- Backend: Nest.js
- Nginx
- MySQL
- phpMyAdmin
When deploying my project locally on Docker (Windows, monitored with Docker Desktop), I simply execute the compose command, which then builds the images and starts the server.
However, I’m uncertain about the best and most secure method for deploying to a remote server (such as droplets on DigitalOcean or Linode). Uploading the original source code of both private projects to the remote server for subsequent building and launching does not sound secure. I prefer not to upload the original source; instead, I want to build these images on my local computer and then transfer them to the remote server. This approach ensures that folders like “src” do not exist on the remote server, only the compiled output directories such as “.next” and “.dist”.
So, what steps should I take to deploy my project securely? Is uploading my original source code to this virtual machine a standard practice?
I haven’t purchased a remote server yet, so I haven’t tested anything yet.
this is a fairly general question (see guidelines for SO). consider reposting in softwarerecs.stackexchange.com