Reputation: 11
I need to deploy my Docker Compose project, but I'm unsure of the correct approach.
The docker-compose.yml file contains several services:
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.
Upvotes: 0
Views: 374
Reputation: 589
This is quite fairly general question as well as its architecture perspective, which is widely can cover.
Here's an example workflow that I can provide briefly and try to avoid SSH to deploy your project. However, if you really need, you can scp
your code.
Run and build app locally. run Docker compose and see if application runs without any errors.
Build image
docker-compose.yaml
file on VM serviceimage:tag
in your compose file that can be connected to the registry endpoints from the VM.Other configuration or architectures are required such adjusting your docker-compose.yaml
file, Network configuration on cloud providers, VM config, etc, which hard to discuss in a thread/question.
Reference:
Upvotes: 0