This repo is aimed to be a template for creating an airflow task (can be extended to any python task not just for airflow) that needs to be packaged as a docker image and run in a container on a Kubernetes Pod.
- README.mdfolder for documentation.
- Template gitignorefile.
- Template requirements/base.txtfile for listing python package dependencies.
- Template src/task.pyfile for writing the main python code.
- Template Dockerfilefor building the repo as Docker image.
- Template docker-compose.yamlfor running the docker image.
- Template cloudbuild.yamlthat referencesDockerfileand build this Dockerfile into a Docker image then pushes it to our Google Artifact Registry.
- Template scriptsfolder for spinning up and down docker containers of the development environment
- .env.samplefile containing needed environment variables to be set when running locally with Docker.
To use this template repo you can clone it locally. Then copy/paste it elsewhere, rename it and edit it as fits your needs.
To Run src/task.py follow these steps:
- 
Copy .env.samplefile into a new.envfile and set the included environment variables.
- 
Build the Docker image and run the container . scripts/dev/start-docker.bash
- 
Stop the container when needed . scripts/dev/start-docker.bash
- 
Run the following commands to install dependencies including private python packages (e.g. pybq) pip install keyrings.google-artifactregistry-auth==1.1.2 pip install --extra-index-url https://oauth2accesstoken:$(gcloud auth print-access-token)@europe-north1-python.pkg.dev/followbreadfast/bf-data-py-packages/simple/ -r requirements/base.txt