Deploy
Build a Docker image
These steps require Docker (opens in a new tab) to be installed on your computer.
First you need to build a Docker image of your microservice:
cd /path/to/microservice
docker build -t dockerusername/your-microservice:version .
Don't forget to replace dockerusername
, yourmicroservice
and version
by you Docker Hub (opens in a new tab) username, your microservice name and its version respectively.
Deploy with Terraform
These steps require Terraform (opens in a new tab) to be installed on your computer.
Once you have a Docker image of your microservice, you can use Terraform to deploy it with all its dependencies (databases, message queue, etc.).
- Copy
terraform/env-example.tfvars
toterraform/env.tfvars
:
cd /path/to/microservice/terraform
cp env-example.tfvars env.tfvars
-
Change deployment variables in
terraform/env.tfvars
as you need (don't forget to change app_docker_image). -
Deploy your microservice:
terraform init
terraform apply -var-file="env.tfvars"