Skip to content
Closed
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
41 changes: 0 additions & 41 deletions .github/workflows/docker-release.yml

This file was deleted.

253 changes: 237 additions & 16 deletions .github/workflows/docker.yml
Original file line number Diff line number Diff line change
@@ -1,12 +1,15 @@
name: Docker

on:
release:
types: [ published ]
push:
branches:
- 'master'
pull_request:
types: [synchronize, opened, reopened, ready_for_review]


jobs:
config:
runs-on: "ubuntu-latest"
Expand All @@ -21,33 +24,253 @@ jobs:
echo "has-secrets=1" >> "$GITHUB_OUTPUT"
echo "has secrets!"
else
echo "has-secrets=0" >> "$GITHUB_OUTPUT"
echo "no secrets!"
fi

@sebastianliebscher sebastianliebscher Oct 8, 2023

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This does not work as expected. The check if: needs.config.outputs.has-secrets returns true in both cases.

Either check for if: needs.config.outputs.has-secrets == 1 or don't set has-secrets when there are no secrets. I went with the latter.


docker-build:

build-lean-image:
name: Build ${{ matrix.image.version }} lean image
needs: config
if: needs.config.outputs.has-secrets
name: docker-build
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
image:
- {version: "3.9-slim-bookworm", suffix: ""}
- {version: "3.10-slim-bookworm", suffix: "-py310"}
steps:
- name: "Checkout ${{ github.ref }} ( ${{ github.sha }} )"
uses: actions/checkout@v3
- name: Checkout
uses: actions/checkout@v4
with:
persist-credentials: false
- name: Docker meta
id: meta
uses: docker/metadata-action@v5
with:
images: ${{ github.repository }}
flavor: |
latest=false
suffix=${{ matrix.image.suffix }}
tags: |
type=sha,prefix=,format=long
type=ref,event=pr
type=raw,value=master,enable={{is_default_branch}}
type=raw,value=latest,enable={{is_default_branch}}
type=pep440,pattern={{version}}
labels: |
target=lean
build_actor=${{ github.actor }}
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Build
uses: docker/build-push-action@v5
with:
context: .
platforms: linux/amd64
load: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
target: lean
build-args: |
PY_VER=${{ matrix.image.version }}
- name: Login to Docker Hub
if: needs.config.outputs.has-secrets
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Push
if: needs.config.outputs.has-secrets
uses: docker/build-push-action@v5
with:
context: .
platforms: linux/amd64
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
target: lean
build-args: |
PY_VER=${{ matrix.image.version }}


build-dev-image:
name: Build dev image
needs: config
if: needs.config.outputs.has-secrets
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
persist-credentials: false
- name: Docker meta
id: meta
uses: docker/metadata-action@v5
with:
images: ${{ github.repository }}
flavor: |
latest=false
suffix=dev
tags: |
type=sha,prefix=,format=long
type=ref,event=pr
type=raw,value=master,enable={{is_default_branch}}
type=raw,value=latest,enable={{is_default_branch}}
type=pep440,pattern={{version}}
labels: |
target=dev
build_actor=${{ github.actor }}
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Build
uses: docker/build-push-action@v5
with:
context: .
platforms: linux/amd64
load: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
target: dev
- name: Login to Docker Hub
if: needs.config.outputs.has-secrets
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Push
if: needs.config.outputs.has-secrets
uses: docker/build-push-action@v5
with:
context: .
platforms: linux/amd64
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
target: dev


build-websocket-image:
name: Build websocket image
needs: config
if: needs.config.outputs.has-secrets
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
persist-credentials: false
- name: Set up QEMU
uses: docker/setup-qemu-action@v1
uses: docker/setup-qemu-action@v3
- name: Docker meta
id: meta
uses: docker/metadata-action@v5
with:
images: ${{ github.repository }}
flavor: |
latest=false
suffix=websocket
tags: |
type=sha,prefix=,format=long
type=ref,event=pr
type=raw,value=master,enable={{is_default_branch}}
type=raw,value=latest,enable={{is_default_branch}}
type=pep440,pattern={{version}}
labels: |
build_actor=${{ github.actor }}
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
- shell: bash
env:
DOCKERHUB_USER: ${{ secrets.DOCKERHUB_USER }}
DOCKERHUB_TOKEN: ${{ secrets.DOCKERHUB_TOKEN }}
run: |
.github/workflows/docker_build_push.sh
uses: docker/setup-buildx-action@v3
- name: Build
uses: docker/build-push-action@v5
with:
context: ./superset-websocket
platforms: linux/amd64,linux/arm64
load: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
- name: Login to Docker Hub
if: needs.config.outputs.has-secrets
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Push
if: needs.config.outputs.has-secrets
uses: docker/build-push-action@v5
with:
context: ./superset-websocket
platforms: linux/amd64,linux/arm64
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}


build-dockerize-image:
name: Build Dockerize image
needs: config
if: needs.config.outputs.has-secrets
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
persist-credentials: false
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Docker meta
id: meta
uses: docker/metadata-action@v5
with:
images: ${{ github.repository }}
flavor: |
latest=false
tags: |
type=raw,value=dockerize,enable={{is_default_branch}}
labels: |
build_actor=${{ github.actor }}
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Build
uses: docker/build-push-action@v5
with:
context: .
file: dockerize.Dockerfile
platforms: linux/amd64,linux/arm64
load: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
- name: Login to Docker Hub
if: needs.config.outputs.has-secrets
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Push
if: needs.config.outputs.has-secrets
uses: docker/build-push-action@v5
with:
context: .
file: dockerize.Dockerfile
platforms: linux/amd64,linux/arm64
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}


# build Dockerfile 'ci' target, save to archive and upload as artifact
build-ephemeral-image:
name: Build ephemeral env image
needs: config
if: github.event_name == 'pull_request'
runs-on: ubuntu-latest
steps:
- name: "Checkout ${{ github.ref }} ( ${{ github.sha }} )"
uses: actions/checkout@v3
with:
persist-credentials: false
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Build ephemeral env image
if: github.event_name == 'pull_request'
run: |
mkdir -p ./build
echo ${{ github.sha }} > ./build/SHA
Expand All @@ -61,9 +284,7 @@ jobs:
--label "build_actor=${GITHUB_ACTOR}" \
.
docker save ${{ github.sha }} | gzip > ./build/${{ github.sha }}.tar.gz

- name: Upload build artifacts
if: github.event_name == 'pull_request'
uses: actions/upload-artifact@v3
with:
name: build
Expand Down
Loading