为Airflow添加自定义的Provider可分为以下步骤:
在Airflow中创建自定义的Provider,可参考官方文档:https://airflow.apache.org/docs/apache-airflow/stable/provider.html#creating-a-provider-package。
在Docker的构建文件中添加以下代码,用于安装自定义的Provider:
RUN pip install
version: '3'
services:
postgres:
image: postgres:9.6
environment:
POSTGRES_USER: airflow
POSTGRES_PASSWORD: airflow
POSTGRES_DB: airflow
volumes:
- postgres_data:/var/lib/postgresql/data
webserver:
build:
context: .
dockerfile: Dockerfile
image: my-airflow:latest
restart: always
depends_on:
- postgres
environment:
EXECUTOR: Local
POSTGRES_USER: airflow
POSTGRES_PASSWORD: airflow
POSTGRES_HOST: postgres
POSTGRES_PORT: 5432
POSTGRES_DB: airflow
AIRFLOW__CORE__LOAD_EXAMPLES: 'False'
AIRFLOW__CORE__LOAD_DEFAULT_CONNECTIONS: 'True'
PYTHONPATH: /usr/local/airflow/plugins:
ports:
- "8080:8080"
volumes:
- ./plugins:/usr/local/airflow/plugins
- ./dags:/usr/local/airflow/dags
- ./logs:/usr/local/airflow/logs
volumes:
postgres_data:
其中,
指的是你创建的自定义Provider的包名。
docker-compose up -d