Deploying Applications with Encore
Deploy with a git push, while Encore provisions your infrastructure
Deploying your first app
Automated deploys need a free Encore account: you push to a git remote, and the platform builds, provisions and deploys for you. Prefer to manage the infrastructure yourself? Build a Docker image instead.
Create your Encore account, then create the app:
$ encore auth signup$ encore app create
encore app create scaffolds a new app, registers it to your account, and adds the encore git remote. Nothing else to set up: skip ahead to Push to deploy.
Integrate with GitHub (optional)
New apps get an Encore managed git repository, which is enough to try things out. For production we recommend integrating with GitHub instead.
Once connected, pushing to GitHub triggers deployments automatically, and Pro users get Preview Environments for each pull request.
Connect your AWS or GCP account (optional)
To deploy to your own cloud account rather than Encore Cloud hosting, see connect your cloud account.
Skipping this deploys to a free Encore hosted environment (Encore Cloud), subject to fair use limits.
Push to deploy
Deploy your application by pushing your code to the connected Git repository.
- Using Encore's managed git:
$ git add -A .$ git commit -m 'Commit message'$ git push encore
- If you have connected your GitHub account:
$ git add -A .$ git commit -m 'Commit message'$ git push origin
This triggers the deployment process, consisting of the following phases:
- A build & test phase
- An infrastructure provisioning phase
- A deployment phase
Once you've pushed your code, you can monitor the progress in the Cloud Dashboard > (Select your app) > Deployments.
Configuring deploy trigger
When using GitHub, you can automatically trigger deploys when you push to a specific branch name.
To configure which branch name is used to trigger deploys, open your app in the Cloud Dashboard and go to the Overview page for your intended environment. Click on Settings and then in the section Branch Push configure the Branch name and hit save.
Integrating using the Encore API
You can trigger deployments using Encore's API, learn more in the API reference.
Configuring custom build settings
If you want, you can override certain aspects of the CI/CD process in the encore.app file:
- The Docker base image to use when deploying
- Whether to build with Cgo enabled
- Whether to bundle the source code in the docker image (useful for Sentry stack traces)
Below are the available build settings configurable in the encore.app file,
with their default values:
encore.app{
"build": {
// Enables cgo when building the application and running tests
// in Encore's CI/CD system.
"cgo_enabled": false,
// Docker-related configuration
"docker": {
// The Docker base image to use when deploying the application.
// It must be a publicly accessible image. It defaults to "scratch" for go apps
// and "node:24-trixie" for typescript apps.
"base_image": "scratch",
// Whether to bundle the source code in the docker image.
// The source code will be copied into /workspace as part
// of the build process. This is primarily useful for tools like
// Sentry that need access to the source code to generate stack traces.
"bundle_source": false,
// The working directory to start the docker image in.
// If empty it defaults to "/workspace" if the source code is bundled, and to "/" otherwise.
"working_dir": ""
}
// Build hooks allow you to run custom commands during the build process.
// They can be specified as a string (e.g. "cmd1 && cmd2") or as an object
// with a command and optional environment variables.
"hooks": {
// Runs before the Encore build, but after dependencies are fetched (e.g. npm install).
"prebuild": "",
// Or as an object:
// "prebuild": {"command": "my-command", "env": {"MY_VAR": "value"}},
// Runs after the Encore build has finished.
"postbuild": ""
// Or as an object:
// "postbuild": {"command": "my-command", "env": {"MY_VAR": "value"}}
}
}
}