CLI & CI Deployments
CI/CD CLI deployment GitHub Actions automated deployment container deployment PAT authenticationDeploying with the CLI
Section titled “Deploying with the CLI”Below you can find a simple script to deploy a Nhost Run service using the CLI. This script can be leveraged on any CI or environment as long as you can install the Nhost CLI and have access to docker buildx.
#!/bin/shSERVICE_ID="2503b290-249c-42f5-b89e-fd9a98980e22"IMAGE="registry.eu-central-1.nhost.run/2503b290-249c-42f5-b89e-fd9a98980e22"PAT="this-is-my-pat"VERSION="1.0.0"CONFIGURATION_FILE="nhost-service.toml"
# this only needs to be done once in each environment# but usually CIs start with a clean environment each time## you can also login with your regular email/password# credentials if you prefernhost login --pat $PAT
# this only needs to be done once in each environment# but usually CIs start with a clean environment each timenhost docker-credentials configure --no-interactive
docker buildx build \ --push \ --platform linux/amd64,linux/arm64 \ -t $IMAGE:$VERSION \ .
nhost run config-deploy \ --config $CONFIGURATION_FILE \ --service-id $SERVICE_IDDeploy from Github Actions
Section titled “Deploy from Github Actions”If you prefer to deploy from GitHub actions we support a few GitHub actions you can use to build your own workflows. We also have an already-made workflow you can leverage and there is a hello-world application you can check for a more thorough example and a step-by-step demo: