Skip to content

Dockerize Dagster

Dockerize Dagster #16

Workflow file for this run

name: Dockerize Dagster
# this will build based on what is committed to the branch
# dockerbuildandpush pulls the repo.
# overwrites any files created.
on:
workflow_dispatch:
push:
# be wary of using ** for the branch...
# it will fail, and only pull the main branch... which means old code, usually
branches:
- main
- dev
- dev_df
tags:
- "v*.*.*"
# https://github.com/marketplace/actions/publish-docker
# https://github.com/docker/build-push-action
defaults:
run:
working-directory: dagster/implnets
jobs:
build:
name: Dockerize Scheduler
runs-on: ubuntu-latest
strategy:
matrix:
# project: [ "eco" ]
project: [ "eco", "iow", "oih" ]
#platform: ["linux/amd64","linux/arm64"]
#platform: ["linux/amd64"] #linux/arm64 issues with building
steps:
- name: Set variables
run: |
REGISTRY_IMAGE=fils/dagster-gleanerio
echo "REGISTRY_IMAGE=$REGISTRY_IMAGE" >> $GITHUB_ENV
working-directory: /
- name: Checkout Repo
uses: actions/checkout@v3
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Login to DockerHub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@v4
with:
images: ${{ env.REGISTRY_IMAGE }}
flavor: |
latest=true
tags: |
type=ref,event=tag
type=ref,event=branch
type=semver,pattern={{version}}
type=sha
# - name: Set up Python 3.10
# uses: actions/setup-python@v4
# with:
# python-version: '3.10'
# - name: Install dependencies
# run: |
# python -m pip install --upgrade pip
# if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
# long version with lint,
# run: |
# python -m pip install --upgrade pip
# pip install flake8 pytest
# if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
# pip install build
# - name: Lint with flake8
# run: |
# # stop the build if there are Python syntax errors or undefined names
# flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
# # exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
# flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
# - name: Build package
# run: python -m build
# - name: Build tooling
# run: |
# cd ./tooling/cfgBuilder/${{ matrix.project }}
# python cfgBuilder.py -s https://foo.us/sitemap.xml
# - name: Generate
# working-directory: dagster/implnets
# run: |
# python pygen.py -cf ./configs/${{ matrix.project }}/gleanerconfig.yaml -od /temp/generatedDocker/implnet-${{ matrix.project }}/output -td ./templates/v1 -d 7
# - name: check
# working-directory: dagster/implnets
# run: |
# cat ./generatedCode/implnet-${{ matrix.project }}/output/ops/implnet_ops_amgeo.py
- name: Build and push
id: build
uses: docker/build-push-action@v4
with:
#context: ./dagster/implnets
# grr https://github.com/docker/build-push-action#git-context
#context: "{{defaultContext}}"
push: true
build-args:
implnet=${{ matrix.project }}
#file: ./dagster/implnets/build/Dockerfile
file: ./build/Dockerfile_dagster
context: "{{defaultContext}}:dagster/implnets"
tags: ${{ steps.meta.outputs.tags }}
# tags: fils/ec_facets_client:latest
labels: ${{ steps.meta.outputs.labels }}
#platforms: ${{ matrix.platform }}
#outputs: type=image,name=${{ env.REGISTRY_IMAGE }},push-by-digest=true,name-canonical=true,push=true
- name: Image digest
run: echo ${{ steps.build.outputs.digest }}
build_code:
name: Dockerize Scheduler CODE for Project
runs-on: ubuntu-latest
strategy:
matrix:
# project: [ "eco" ]
project: [ "eco", "iow", "oih" ]
#platform: ["linux/amd64","linux/arm64"]
#platform: ["linux/amd64"] #linux/arm64 issues with building
steps:
- name: Set variables
run: |
REGISTRY_IMAGE=fils/dagster-gleanerio-${{ matrix.project }}
echo "REGISTRY_IMAGE=$REGISTRY_IMAGE" >> $GITHUB_ENV
working-directory: /
- name: Checkout Repo
uses: actions/checkout@v3
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Login to DockerHub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@v4
with:
images: ${{ env.REGISTRY_IMAGE }}
flavor: |
latest=true
tags: |
type=ref,event=tag
type=ref,event=branch
type=semver,pattern={{version}}
type=sha
build_code_workflows:
name: Dockerize Scheduler Workflows base
runs-on: ubuntu-latest
#strategy:
#matrix:
# project: [ "eco" ]
#project: [ "eco", "iow", "oih" ]
#platform: ["linux/amd64","linux/arm64"]
#platform: ["linux/amd64"] #linux/arm64 issues with building
steps:
- name: Set variables
run: |
REGISTRY_IMAGE=fils/dagster-gleanerio-workflows
echo "REGISTRY_IMAGE=$REGISTRY_IMAGE" >> $GITHUB_ENV
working-directory: /
- name: Checkout Repo
uses: actions/checkout@v3
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Login to DockerHub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@v4
with:
images: ${{ env.REGISTRY_IMAGE }}
flavor: |
latest=true
tags: |
type=ref,event=tag
type=ref,event=branch
type=semver,pattern={{version}}
type=sha
# - name: Set up Python 3.10
# uses: actions/setup-python@v4
# with:
# python-version: '3.10'
# - name: Install dependencies
# run: |
# python -m pip install --upgrade pip
# if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
# long version with lint,
# run: |
# python -m pip install --upgrade pip
# pip install flake8 pytest
# if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
# pip install build
# - name: Lint with flake8
# run: |
# # stop the build if there are Python syntax errors or undefined names
# flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
# # exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
# flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
# - name: Build package
# run: python -m build
# - name: Build tooling
# run: |
# cd ./tooling/cfgBuilder/${{ matrix.project }}
# python cfgBuilder.py -s https://foo.us/sitemap.xml
# - name: Generate
# working-directory: dagster/implnets
# run: |
# python pygen.py -cf ./configs/${{ matrix.project }}/gleanerconfig.yaml -od /temp/generatedDocker/implnet-${{ matrix.project }}/output -td ./templates/v1 -d 7
# - name: check
# working-directory: dagster/implnets
# run: |
# cat ./generatedCode/implnet-${{ matrix.project }}/output/ops/implnet_ops_amgeo.py
- name: Build and push
id: build
uses: docker/build-push-action@v4
with:
#context: ./dagster/implnets
# grr https://github.com/docker/build-push-action#git-context
#context: "{{defaultContext}}"
push: true
build-args:
implnet=${{ matrix.project }}
#file: ./dagster/implnets/build/Dockerfile
file: ./build/Dockerfile_workflows
context: "{{defaultContext}}:dagster/implnets"
tags: ${{ steps.meta.outputs.tags }}
# tags: fils/ec_facets_client:latest
labels: ${{ steps.meta.outputs.labels }}
#platforms: ${{ matrix.platform }}
#outputs: type=image,name=${{ env.REGISTRY_IMAGE }},push-by-digest=true,name-canonical=true,push=true
- name: Image digest
run: echo ${{ steps.build.outputs.digest }}