Deploy a prebuilt image
By default, running astro deploy
with the Astro CLI builds your project into a Docker image and deploys it to Astronomer Software. In some cases, you might want to skip the build step and deploy a prebuilt Docker image instead.
Deploying a prebuilt Docker image allows you to:
- Test a single Docker image across Deployments instead of rebuilding it each time.
- Reduce the time it takes to deploy. If your project has a number of packages that take a long time to install, it can be more efficient to build it separately.
- Specify additional mounts and arguments in your project, which is required for setups such as installing Python packages from private sources.
Prerequisites
In order to push code to a Deployment on Astronomer, you must have:
- The Astro CLI installed.
- Access to an Astronomer platform at
https://app.BASEDOMAIN
. - An Astronomer Workspace with at least one active Airflow Deployment.
- If your image names include a sha, you also need to configure the CLI to set
sha_as_tag
astrue
.
Step 1: (Optional) Create a Docker image
-
Run
docker build
from an Astro project directory or specify the command in a CI/CD pipeline. This Docker image must be based on Astro Runtime and be available in a local Docker registry. If you run this command on an Apple M1 computer or on a computer with an ARM64 processor, you must specify--platform=linux/amd64
or else the deploy will fail. Astro Deployments require an AMD64-based image and do not support ARM64 architecture. -
(Optional) Test your Docker image in a local Airflow environment by adding the
--image-name=<image-name>
flag to any of the following commands:astro dev start
astro dev restart
astro dev parse
astro dev pytest
Step 2: Deploy code
If you have the image locally, run the following command or specify it in a CI/CD pipeline:
astro deploy --image-name=<image-name>
Additional deploy options
If your image is in a remote repo, add the --remote
flag with the path for the image and the --runtime-version
.
astro deploy --image-name=<image-name> --remote=<path> --runtime-version=<runtime-version>
If you have DAG-only deploys enabled, you can also use the `--image` flag to deploy a prebuilt image without also deploying your DAGs folder. Use:
```sh
astro deploy --image-name=<image-name> --image
For more information about the different command options, such as specifying a remote private repository or configuring an Astronomer Runtime version, see the CLI command reference.
If you build an AMD64-based image and run astro deploy
from an Apple M1 computer, you might see a warning in your terminal. You can ignore the warning.
WARNING: The requested image's platform (linux/amd64) does not match the detected host platform
(linux/arm64/v8) and no specific platform was requested