We can directly deploy containers into VM instance of Google Compute Engine, instead of launching a heavy Kubernetes cluster. The command looks like:
gcloud compute instances create-with-container $(VM_NAME) \ --container-image=$(IMAGE_NAME) \ --machine-type n1-standard-1 \ --labels team=mle,product=decision-engine \ --zone us-east1-a
To add enviroment variables to this container, we just need to add an argument:
To let the container run command for us, we need to add command arguments:
--container-command "/bin/bash" \ --container-arg="-c" \ --container-arg="make all; bash next.sh"
There is still a problem: the VM instance will run this container again and again even the result of the task in container is successful.
To solve this, we just need to add another argument: