|
1 |
| -# This is a basic workflow to help you get started with Actions |
| 1 | +#This GitHub Workflow builds the necessary docker images for the `from jupyter to production workshop` |
| 2 | +name: Build and publish workshop Docker images 🔨🐳🚀 |
2 | 3 |
|
3 |
| -name: CI |
4 |
| - |
5 |
| -# Controls when the action will run. |
6 | 4 | on:
|
7 |
| - # Triggers the workflow on push or pull request events but only for the master branch |
| 5 | + # Triggers the workflow when a new tag with the pattern 'v*.*.*' is pushed to the repository |
8 | 6 | push:
|
9 |
| - branches: [ master ] |
10 |
| - pull_request: |
11 |
| - branches: [ master ] |
| 7 | + tags: |
| 8 | + - 'v*.*.*' |
12 | 9 |
|
13 | 10 | # Allows you to run this workflow manually from the Actions tab
|
14 | 11 | workflow_dispatch:
|
15 | 12 |
|
16 |
| -# A workflow run is made up of one or more jobs that can run sequentially or in parallel |
17 | 13 | jobs:
|
18 |
| - # This workflow contains a single job called "build" |
19 |
| - build: |
20 |
| - # The type of runner that the job will run on |
| 14 | + # This job creates and publishes the mlflow docker images |
| 15 | + build-mlflow: |
21 | 16 | runs-on: ubuntu-latest
|
22 |
| - |
23 |
| - # Steps represent a sequence of tasks that will be executed as part of the job |
24 | 17 | steps:
|
25 |
| - # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it |
26 |
| - - uses: actions/checkout@v2 |
27 |
| - |
28 |
| - - name: Login to Docker Hub |
29 |
| - uses: docker/login-action@v1 |
30 |
| - with: |
31 |
| - username: ${{ secrets.DOCKERHUB_USER }} |
32 |
| - password: ${{ secrets.DOCKERHUB_PASSWORD }} |
| 18 | + - name: Checkout Repo ✅ |
| 19 | + uses: actions/checkout@v2 |
33 | 20 |
|
34 |
| - - name: Set up QEMU |
35 |
| - uses: docker/setup-qemu-action@v1 |
| 21 | + - name: Job preparation 🛫 # Steps that must be carried out before creating the Docker images |
| 22 | + uses: ./.github/actions/shared-build-steps |
36 | 23 | with:
|
37 |
| - platforms: amd64 |
| 24 | + dockerhub_user: ${{ secrets.DOCKERHUB_USER }} |
| 25 | + dockerhub_password: ${{ secrets.DOCKERHUB_PASSWORD }} |
| 26 | + runner_os: ${{ runner.os }} |
| 27 | + github_sha: ${{ github.sha }} |
38 | 28 |
|
39 |
| - - name: Set up Docker Buildx |
40 |
| - id: buildx |
41 |
| - uses: docker/setup-buildx-action@v1 |
42 |
| - |
43 |
| - - name: Cache Docker layers |
44 |
| - uses: actions/cache@v2 |
| 29 | + - name: Docker meta 💬 # Creating meta information such as the image tag for the Docker image |
| 30 | + id: meta |
| 31 | + uses: docker/metadata-action@v5 |
45 | 32 | with:
|
46 |
| - path: /tmp/.buildx-cache |
47 |
| - key: ${{ runner.os }}-buildx-${{ github.sha }} |
48 |
| - restore-keys: | |
49 |
| - ${{ runner.os }}-buildx- |
50 |
| - |
51 |
| - - name: Build and push jupyter Docker image |
52 |
| - id: docker_build_amd64_jupyter |
| 33 | + images: codecentric/from-jupyter-to-production-mlflow |
| 34 | + |
| 35 | + - name: Build and push mlflow Docker image 🔨🐳 |
| 36 | + id: docker_build_mlflow |
53 | 37 |
|
54 | 38 | with:
|
55 | 39 | context: .
|
56 |
| - file: ./docker/jupyter/Dockerfile |
57 |
| - tags: codecentric/from-jupyter-to-production-jupyter:latest |
58 |
| - push: true |
| 40 | + file: ./docker/mlflow/Dockerfile |
| 41 | + tags: ${{ steps.meta.outputs.tags }} |
| 42 | + push: ${{ github.event_name != 'pull_request' }} |
59 | 43 | builder: ${{ steps.buildx.outputs.name }}
|
60 | 44 | cache-from: type=local,src=/tmp/.buildx-cache
|
61 | 45 | cache-to: type=local,dest=/tmp/.buildx-cache
|
62 |
| - platforms: linux/amd64 |
63 |
| - - name: Build and push dagster Docker image |
64 |
| - id: docker_build_amd64_dagster |
65 |
| - |
| 46 | + platforms: linux/amd64,linux/arm64 |
| 47 | + |
| 48 | + - name: Image digest |
| 49 | + run: echo ${{ steps.docker_build.outputs.digest }} |
| 50 | + |
| 51 | + # This job creates and publishes the jupyter docker images |
| 52 | + build-jupyter: |
| 53 | + runs-on: ubuntu-latest |
| 54 | + steps: |
| 55 | + - name: Checkout Repo ✅ |
| 56 | + uses: actions/checkout@v2 |
| 57 | + |
| 58 | + - name: Job preparation 🛫 # Steps that must be carried out before creating the Docker images |
| 59 | + uses: ./.github/actions/shared-build-steps |
66 | 60 | with:
|
67 |
| - context: . |
68 |
| - file: ./docker/dagster/Dockerfile |
69 |
| - tags: codecentric/from-jupyter-to-production-dagster:latest |
70 |
| - push: true |
71 |
| - builder: ${{ steps.buildx.outputs.name }} |
72 |
| - cache-from: type=local,src=/tmp/.buildx-cache |
73 |
| - cache-to: type=local,dest=/tmp/.buildx-cache |
74 |
| - platforms: linux/amd64 |
75 |
| - - name: Build and push mlflow Docker image |
76 |
| - id: docker_build_amd64_mlflow |
| 61 | + dockerhub_user: ${{ secrets.DOCKERHUB_USER }} |
| 62 | + dockerhub_password: ${{ secrets.DOCKERHUB_PASSWORD }} |
| 63 | + runner_os: ${{ runner.os }} |
| 64 | + github_sha: ${{ github.sha }} |
| 65 | + |
| 66 | + - name: Docker meta 💬 # Creating meta information such as the image tag for the Docker image |
| 67 | + id: meta |
| 68 | + uses: docker/metadata-action@v5 |
| 69 | + with: |
| 70 | + images: codecentric/from-jupyter-to-production-jupyter |
| 71 | + |
| 72 | + - name: Build and push juypter Docker image 🔨🐳 |
| 73 | + id: docker_build_mlflow |
77 | 74 |
|
78 | 75 | with:
|
79 | 76 | context: .
|
80 |
| - file: ./docker/mlflow/Dockerfile |
81 |
| - tags: codecentric/from-jupyter-to-production-mlflow:latest |
82 |
| - push: true |
| 77 | + file: ./docker/jupyter/Dockerfile |
| 78 | + tags: ${{ steps.meta.outputs.tags }} |
| 79 | + push: ${{ github.event_name != 'pull_request' }} |
83 | 80 | builder: ${{ steps.buildx.outputs.name }}
|
84 | 81 | cache-from: type=local,src=/tmp/.buildx-cache
|
85 | 82 | cache-to: type=local,dest=/tmp/.buildx-cache
|
86 |
| - platforms: linux/amd64 |
| 83 | + platforms: linux/amd64,linux/arm64 |
87 | 84 |
|
88 | 85 | - name: Image digest
|
89 | 86 | run: echo ${{ steps.docker_build.outputs.digest }}
|
0 commit comments