Skip to content

Initial (#1)

Initial (#1) #1

Workflow file for this run

name: Build Airflow image
on:
workflow_dispatch:
inputs:
airflow_version:
description: 'Airflow version'
required: true
default: 'default'
type: string
python_version:
description: 'Python version'
required: true
default: 'default'
type: string
push:
branches:
- main
paths:
- image/Dockerfile
- image/requirements.txt
env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}
jobs:
build_airflow:
runs-on: ubuntu-latest
permissions:
packages: write
contents: read
steps:
- name: Checkout source
uses: actions/checkout@v4
- name: Set variables
run: |
if [ "${{ inputs.airflow_version }}" == "" ] || [ "${{ inputs.airflow_version }}" == "default" ]; then
AIRFLOW_VERSION=$(sed -n 's/^ARG AIRFLOW_VERSION=//p' image/Dockerfile)
else
AIRFLOW_VERSION=${{ inputs.airflow_version }}
fi
if [ "${{ inputs.python_version }}" == "" ] || [ "${{ inputs.python_version }}" == "default" ]; then
PYTHON_VERSION=$(sed -n 's/^ARG PYTHON_VERSION=//p' image/Dockerfile)
else
PYTHON_VERSION=${{ inputs.python_version }}
fi
echo "AIRFLOW_VERSION=${AIRFLOW_VERSION}" >> ${GITHUB_ENV}
echo "PYTHON_VERSION=${PYTHON_VERSION}" >> ${GITHUB_ENV}
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Log in to the Github Packages container registry
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
logout: false
- name: Docker meta
id: meta
uses: docker/metadata-action@v5
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}/airflow
tags: |
type=raw,value=${{ env.AIRFLOW_VERSION }}-python${{ env.PYTHON_VERSION }}-{{date 'YYYYMMDD-HHmm'}}
type=raw,value=${{ env.AIRFLOW_VERSION }}-python${{ env.PYTHON_VERSION }}
labels: |
org.opencontainers.image.description=Onyx Airflow image
- name: Build and push Docker image
uses: docker/build-push-action@v5
with:
context: image
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
sbom: false
provenance: false
build-args: |
AIRFLOW_VERSION=${{ env.AIRFLOW_VERSION }}
PYTHON_VERSION=${{ env.PYTHON_VERSION }}