change docker compose for AIrflow

Viewed 387

I am using docker-compose for airflow, as described in the docker-compose.yml file

version: '3'
services:
  postgres:
    image: postgres:9.6
    environment:
      - POSTGRES_USER=airflow
      - POSTGRES_PASSWORD=airflow
      - POSTGRES_DB=airflow
    ports:
      - "5432:5432"

  webserver:
    image: puckel/docker-airflow:1.10.1
    build:
      context: https://github.com/puckel/docker-airflow.git#1.10.1
      dockerfile: Dockerfile
      args:
        AIRFLOW_DEPS: gcp_api,s3
        PYTHON_DEPS: sqlalchemy==1.2.0
    restart: always
    depends_on:
      - postgres
    environment:
      - LOAD_EX=n
      - EXECUTOR=Local
      - FERNET_KEY=jsDPRErfv8Z_eVTnGfF8ywd19j4pyqE3NpdUBA_oRTo=
    volumes:
      - ./examples/intro-example/dags:/usr/local/airflow/dags
      # Uncomment to include custom plugins
      # - ./plugins:/usr/local/airflow/plugins
    ports:
      - "8080:8080"
    command: webserver
    healthcheck:
      test: ["CMD-SHELL", "[ -f /usr/local/airflow/airflow-webserver.pid ]"]
      interval: 30s
      timeout: 30s
      retries: 3

that I am tooking from tuanavu github repo.

My aim is to enable importing airflow variables from a json file with the following comment : airflow variables --import /variables.json.

I want to override the entrypoint.sh file used by the docker image puckel/docker-airflow:1.10.1

This can be done by adding the fllowing bloc to the entrypoint.sh file used by the docker image puckel/docker-airflow:1.10.1:

if [ -e "/variables.json" ]; then
  airflow variables --import /variables.json
fi

in a specific place of the entrypoint.sh of the docker image puckel/docker-airflow:1.10.1

Is there a way please I can do this in the docker-compose.yml file

0 Answers
Related