Skip to main content
By default, fly deploy builds and deploys a fly.toml file, a Dockerfile, and source code from the current working directory. This is sufficient for deploying a single app, but you can also configure flyctl to build and deploy multiple apps from a monorepo or deploy an app to multiple targets.

Paths

Working directory

The first argument to fly deploy is the path to the working directory for your app’s source code. For Dockerfile and Buildpack builds, this is the build context sent to the Docker daemon. It defaults to the current working directory. You can override this by providing a path:

fly.toml path

By default, fly deploy will look for a fly.toml in the working directory. You can override this using the --config option.

Dockerfile path

By default, fly deploy will look for a Dockerfile in the working directory. You can override this using the --dockerfile option.

Multi-stage Build Target

By default, the final stage of a multi-stage dockerfile is exported as the deployed image. You can stop at a specific stage by using the --build-target option:

Combining options

When you specify a working directory, the --config and --dockerfile paths are relative to the working directory (build context), not your current directory. For example, given this structure:
This won’t work, because ./flyio/my-app.toml doesn’t exist inside ./my-app:
Instead, use a path relative to the working directory:

Examples

Use a different fly.toml file per environment
Use a different Dockerfile per environment
Deploy a subdirectory
Share a multi-stage Dockerfile with several Fly Apps