Giter VIP home page Giter VIP logo

airflow_custom_built_docker's Introduction

Build a custom airflow image for production

Although there's a lot of off-the-shelf airflow images on dockerhub, they are made for convience instead of production. To bring your workload to a production, your need to make sure the vulnerability is under control. This is where building your Airflow image from scratch comes into play."

Getting started

This repository offers a Dockerfile accompanied by a Docker Compose YAML file. These resources are provided for those who wish to host Airflow on their local computer or a standalone machine.

Version of Airflow and Python we're using

  • python>=3.8
  • airflow==2.8.0

The version we have opted to build is determined based on the existing vulnerabilities(no high and critical level).

note: If you'd like to have python3.10 or later version check Dockerfile.py310.

Other packages

Here's a sample list of packages for running Airflow: you can add your own packages to this requirements.

apache-airflow-providers-celery>=3.4.1 ; python_version >= "3.8" 
redis==4.6.0
apache-airflow==2.8.0 ; python_version >= "3.8"

Build docker image

Two ways to build you own Airflow image:

  • Build from Dockerfile in the repository
    1. clone the repository
    git clone [email protected]:hero710690/airflow_custom_built_docker.git
    
    1. build
    docker build -t airflow-custom:2.8.0 .
    or build with specified dockerfile
    docker build -t airflow-custom:2.8.0_py3.10 -f Dockerfile.py310
  • Create you own Dockerfile using the image on DockerHub as the base image
    FROM jeanlee/airflow-custom:2.8.0
    ...

Start the Airflow Services

  • Build docker network for the network between Airflow services

    docker network create airflow_network
  • Utilize the Dockerfile in the repository to build and initiate the service.

    check the yaml configuration

    version: '3'
    x-airflow-common:
    &airflow-common
    # leave the following line commented out
    #image: ${AIRFLOW_IMAGE_NAME:-jeanlee/airflow-custom:2.8.0}
    build: .

    execute docker compose command

    docker-compose up -d --build
    # Run the container in the background

    This command will start the Airflow services, building the necessary components as specified in the provided Dockerfile. The -d flag ensures the container runs in the background for seamless execution.

  • Run the service without building image

    version: '3'
    x-airflow-common:
    &airflow-common
    # replcae the image field with your own image
    image: ${AIRFLOW_IMAGE_NAME:-jeanlee/airflow-custom:2.8.0b1}
    # leave the following line commented out
    # build: .

    execute docker compose command

    docker-compose up -d
    # Run the container in the background

    Check more information on Medium blog at https://medium.com/@hero710690/securing-your-airflow-on-production-building-docker-images-with-less-vulnerabilities-7f42e096b885.

airflow_custom_built_docker's People

Contributors

hero710690 avatar jeanyclee avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.