> ## Documentation Index
> Fetch the complete documentation index at: https://astronomer.io/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Deploy code overview

Deploying code is the process of pushing code to an Astro Private Cloud (APC) Deployment. A code deploy can include an entire Astro project as a Docker image, or just the Dags in your project. APC supports several methods for deploying code to a Deployment:

* Deploy [project images](#full-image-deploy) or [Dags only](/docs/astro-private-cloud/v-2-x/deploy-dags) using the Astro CLI
* Deploy Dags using an [NFS volume](/docs/astro-private-cloud/v-2-x/deploy-nfs)
* Deploy Dags using [Git sync](/docs/astro-private-cloud/v-2-x/deploy-git-sync)

Use this document to understand each method and choose the right approach for your use case.

## Deployment methods comparison

| Method           | Use Case                                    | Downtime      | Dependencies | Requirements   |
| ---------------- | ------------------------------------------- | ------------- | ------------ | -------------- |
| CLI - Full Image | Production deployments with OS dependencies | Brief restart | Supports all | Docker, CLI    |
| CLI - Dag Only   | Quick Dag updates                           | None          | Dags only    | Docker, CLI    |
| NFS Volume       | Shared filesystem environments              | None          | Dags only    | NFS server     |
| Git Sync         | GitOps workflows                            | None          | Dags only    | Git repository |

## Astro CLI deploys

### Full image deploy

By default, deploy code by building it into a Docker image and pushing to the Astronomer Registry using the CLI.

This mechanism builds your Dags into a Docker image alongside all other files in your Astro project directory:

* Python packages (`requirements.txt`)
* OS-level packages (`packages.txt`)
* Dockerfile customizations
* Plugins and include files

The resulting image generates Docker containers for each Airflow component. Every time you run `astro deploy`, your project is rebuilt into a new image and containers are restarted.

```bash wrap theme={null}
# Deploy full project image
astro deploy <deployment-id>
```

#### When to use

* Python or OS dependency updates
* Custom Dockerfile modifications
* Initial deployment setup
* Major version changes

### Dag-only deploy

For faster iteration, enable [Dag-only deploys](/docs/astro-private-cloud/v-2-x/deploy-dags) to deploy just your `dags` directory without rebuilding the Docker image.

```bash wrap theme={null}
# Deploy Dags only (no image rebuild)
astro deploy <deployment-id> --dags
```

#### When to use

* Frequent Dag changes
* No dependency changes
* Development workflows
* Quick fixes

<Note>
  You still need Docker access to authenticate to APC before deploying Dags.
</Note>

## NFS volume-based Dag deploys

For teams deploying Dag changes frequently, APC supports [NFS volume-based](https://kubernetes.io/docs/concepts/storage/volumes/#nfs) Dag deploys.

Using this mechanism, deploy Dags by adding Python files to a shared filesystem on your network. Compared to image-based deploys, NFS enables:

* Zero downtime deployments
* Continuous deployment workflows
* Shared Dag storage across environments

```mermaid actions={true} theme={null}
flowchart TD
    A["NFS Server (/dags)"] --> B["Airflow Pods (read-only mount)"]
```

### When to use

* Enterprise environments with existing NFS infrastructure
* High-frequency Dag updates
* Shared Dag development across teams

#### Requirements

* NFS server accessible from Kubernetes cluster
* Platform-level configuration enabled
* Read access for UID/GID 50000

For configuration details, see [Deploy Dags via NFS volume](/docs/astro-private-cloud/v-2-x/deploy-nfs).

## Git-sync Dag deploys

For Git-based workflows, APC supports [git-sync](https://github.com/kubernetes/git-sync) deployments.

Configure a Git repository to sync with your Deployment. When you push changes to the repository, Dags automatically sync with no downtime.

```mermaid actions={true} theme={null}
flowchart TD
    A["Git Repository"] -->|poll or webhook| B["Git-Sync Relay"]
    B --> C["Airflow Pods"]
```

### Sync modes

* **Polling**: Periodically checks for changes (default: every 60 seconds)
* **Webhook**: Triggers sync on push events

#### When to use

* GitOps deployment workflows
* Version-controlled Dag management
* CI/CD pipeline integration
* Branch-based deployment strategies

For configuration details, see [Deploy Dags via git sync](/docs/astro-private-cloud/v-2-x/deploy-git-sync).

## Choose a deployment method

### Decision tree

```mermaid actions={true} theme={null}
flowchart TD
    A([Start]) --> B{Do you need to deploy\nPython/OS dependencies?}
    B -- Yes --> C([CLI Full Image Deploy])
    B -- No --> D{Do you have existing\nNFS infrastructure?}
    D -- Yes --> E([NFS Volume Deploy])
    D -- No --> F{Do you use\nGitOps workflows?}
    F -- Yes --> G([Git Sync Deploy])
    F -- No --> H([CLI Dag-Only Deploy])
```

### Combine methods

You can combine deployment methods:

* Use **CLI Full Image** for dependency updates
* Use **CLI Dag-Only** for quick Dag iterations
* Use **Git Sync** for automated production deployments

<Note>
  NFS and Git Sync are mutually exclusive with CLI deploys for the same Deployment. Once configured, a Deployment uses only that mechanism.
</Note>

## CI/CD integration

All deployment methods integrate with CI/CD pipelines:

| Method         | CI/CD Approach                    |
| -------------- | --------------------------------- |
| CLI Full Image | `astro deploy` in pipeline        |
| CLI Dag-Only   | `astro deploy --dags` in pipeline |
| NFS Volume     | Copy files to NFS mount           |
| Git Sync       | Push to configured branch         |

## Related documentation

* [Deploy code via the CLI](#astro-cli-deploys)
* [Deploy Dags only](/docs/astro-private-cloud/v-2-x/deploy-dags)
* [Deploy Dags via NFS volume](/docs/astro-private-cloud/v-2-x/deploy-nfs)
* [Deploy Dags via git sync](/docs/astro-private-cloud/v-2-x/deploy-git-sync)
