Skip to content

Commit

Permalink
Merge pull request #33 from dfinity/containers
Browse files Browse the repository at this point in the history
Separate builds of our own customized Airflow container and the content syncer one.
  • Loading branch information
DFINITYManu authored Aug 13, 2024
2 parents c87a5b0 + 55a4ce2 commit d5cce9e
Show file tree
Hide file tree
Showing 3 changed files with 84 additions and 66 deletions.
Original file line number Diff line number Diff line change
@@ -1,16 +1,14 @@
name: Airflow containers
name: Airflow content syncer container
on:
push:
branches:
- "main"
paths:
- airflow-content-syncer/**
- airflow-customized/**
- .github/**
pull_request:
paths:
- airflow-content-syncer/**
- airflow-customized/**
- .github/**

concurrency:
Expand Down Expand Up @@ -49,37 +47,6 @@ jobs:
cache: false
cache-repository: ghcr.io/${{ github.repository }}/cache
context: airflow-content-syncer
build-airflow-customized:
name: Build customized Airflow container
if: github.event_name == 'pull_request'
runs-on: ubuntu-latest
# This image is based on ubuntu:20.04
steps:
- uses: actions/checkout@v4
- uses: docker/metadata-action@v5
id: metadata
with:
images: ghcr.io/${{ github.repository }}/airflow-customized
tags: |
type=schedule
type=ref,event=branch
type=ref,event=tag
type=ref,event=pr
type=sha,format=long
- uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- uses: int128/kaniko-action@v1
name: Create airflow-customized container
with:
push: false
tags: ${{ steps.metadata.outputs.tags }}
labels: ${{ steps.metadata.outputs.labels }}
cache: false
cache-repository: ghcr.io/${{ github.repository }}/cache
context: airflow-customized
publish-airflow-content-syncer:
name: Publish Airflow content syncer container
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
Expand Down Expand Up @@ -111,35 +78,3 @@ jobs:
cache: false
cache-repository: ghcr.io/${{ github.repository }}/cache
context: airflow-content-syncer
publish-airflow-customized:
name: Publish customized Airflow container
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
runs-on: ubuntu-latest
# This image is based on ubuntu:20.04
steps:
- uses: actions/checkout@v4

- uses: docker/metadata-action@v5
id: metadata
with:
images: ghcr.io/${{ github.repository }}/airflow-customized
tags: |
type=schedule
type=ref,event=branch
type=ref,event=tag
type=ref,event=pr
type=sha,format=long
- uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- uses: int128/kaniko-action@v1
name: Create and publish airflow-customized container
with:
push: true
tags: ${{ steps.metadata.outputs.tags }}
labels: ${{ steps.metadata.outputs.labels }}
cache: false
cache-repository: ghcr.io/${{ github.repository }}/cache
context: airflow-customized
81 changes: 81 additions & 0 deletions .github/workflows/airflow-customized-container.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
name: Airflow customized container
on:
push:
branches:
- "main"
paths:
- airflow-customized/**
- .github/**
pull_request:
paths:
- airflow-customized/**
- .github/**

concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true

jobs:
build-airflow-customized:
name: Build customized Airflow container
if: github.event_name == 'pull_request'
runs-on: ubuntu-latest
# This image is based on ubuntu:20.04
steps:
- uses: actions/checkout@v4
- uses: docker/metadata-action@v5
id: metadata
with:
images: ghcr.io/${{ github.repository }}/airflow-customized
tags: |
type=schedule
type=ref,event=branch
type=ref,event=tag
type=ref,event=pr
type=sha,format=long
- uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- uses: int128/kaniko-action@v1
name: Create airflow-customized container
with:
push: false
tags: ${{ steps.metadata.outputs.tags }}
labels: ${{ steps.metadata.outputs.labels }}
cache: false
cache-repository: ghcr.io/${{ github.repository }}/cache
context: airflow-customized
publish-airflow-customized:
name: Publish customized Airflow container
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
runs-on: ubuntu-latest
# This image is based on ubuntu:20.04
steps:
- uses: actions/checkout@v4

- uses: docker/metadata-action@v5
id: metadata
with:
images: ghcr.io/${{ github.repository }}/airflow-customized
tags: |
type=schedule
type=ref,event=branch
type=ref,event=tag
type=ref,event=pr
type=sha,format=long
- uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- uses: int128/kaniko-action@v1
name: Create and publish airflow-customized container
with:
push: true
tags: ${{ steps.metadata.outputs.tags }}
labels: ${{ steps.metadata.outputs.labels }}
cache: false
cache-repository: ghcr.io/${{ github.repository }}/cache
context: airflow-customized
2 changes: 2 additions & 0 deletions airflow-customized/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ USER root
RUN \
apt-get update && \
apt-get install -y git && \
apt-get purge -y msodbcsql18 odbcinst && \
apt-get upgrade -y && \
apt-get clean && \
rm -rf /var/lib/apt/lists/* /var/log/*

Expand Down

0 comments on commit d5cce9e

Please sign in to comment.