Deploying a custom Runtime image with a CI/CD pipeline requires additional configurations. For an example implementation, see the GitHub Actions CI/CD templates for Astro and Astro Private Cloud.
Setup
- Private GitHub Repo
- Private PyPi Index
Install Python packages from private GitHub repositories
This topic provides instructions for building your Astro project with Python packages from a private GitHub repository. Although GitHub is used in these examples, the same approach works with any hosted Git repository.- Using .netrc build secrets
- Using SSH keys
Use the For example, to install If you don’t use the GitHub CLI, replace To run tests:The
--build-secrets flag to pass .netrc credentials at build time. This approach lets you add private packages to your requirements.txt file without custom Dockerfile configuration.This method requires Astro Runtime 3.1-14+, 3.0-15+, or later than 13.5.1.
Prerequisites
- The Astro CLI
- An Astro project
- Custom Python packages that are installable with pip
- A private GitHub repository for each of your custom Python packages
- The GitHub CLI or a GitHub personal access token
Step 1: Specify the private repository in your project
Add your private packages to yourrequirements.txt file using HTTPS URLs in the following format:mypackage1 and mypackage2 from myorganization:Step 2: Configure credentials
Define theNETRC_CONTENT environment variable in your shell profile (.bashrc or .zshrc):$(gh auth token) with a GitHub personal access token that has access to your private repositories.Step 3: Run with build secrets
Pass the--build-secrets flag when running Astro CLI commands:--build-secrets flag securely provides the .netrc content during the Docker build without storing credentials in the image.Deploy with GitHub Actions
To build your image in a GitHub Actions workflow, pass the.netrc content as a build secret:Deploy with the Astronomer deploy action
To deploy using the Astronomer deploy action, pass the.netrc content through build-secrets and set the NETRC_CONTENT environment variable: