Skip to content

Commit ac64aa7

Browse files
author
Prabhakar Kumar
committed
Introducing support for R2023b. Default OS updated to ubuntu22.04. Dockerfiles for ubuntu20.04 are moved to a new sub-folder.
1 parent 2c25c56 commit ac64aa7

28 files changed

+1378
-346
lines changed

.github/actions/build-and-push-notebook/action.yml

Lines changed: 0 additions & 22 deletions
This file was deleted.

.github/workflows/README.md

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
# Workflows in matlab-integration-for-jupyter
2+
3+
This repository uses workflows to build the Dockerfiles hosted in this repository and publish them to GHCR.
4+
5+
## Overview
6+
7+
There are 2 kinds of YML files used here:
8+
1. `build-and-publish-docker-image.yml`, which specifies a reusable workflow, which MUST be called from a workflow configuration file.
9+
2. Other YML files in the `.github/workflows` directory call this reusable-workflow.
10+
11+
Each of these workflows:
12+
a. Monitors a specific Dockerfile. For example, the file `matlab-ubuntu20.04-mounted-dockerfile.yml` monitors the Dockerfile `matlab/ubuntu20.04/Dockerfile.mounted`
13+
b. Is triggered when changes are made to the Dockerfile it monitors. This should build and publish to the configured registries.
14+
15+
## Triggers and Scheduled Jobs
16+
17+
All workflows are scheduled to run on Monday at 00:00.
18+
Workflows are also triggered when you push any changes to the directories with Dockerfiles.
19+
Workflows can be manually triggered from the "Actions" tab.
20+
21+
## Directory structure
22+
23+
The matlab-integration-for-jupyter repository has the following folder structure:
24+
25+
1. matlab : Hosts the Dockerfile that showcase access to matlab through the `jupyter-matlab-proxy` package.
26+
* matlab/ubuntu20.04 : Hosts the same dockerfiles but with support for `ubuntu20.04`
27+
1. matlab-vnc : Hosts the Dockerfile that showcase access to matlab through the `jupyter-matlab-vnc-proxy` package.
28+
* matlab-vnc/ubuntu20.04 : Hosts the same dockerfiles but with support for `ubuntu20.04`
29+
30+
## Images Pushed to GHCR:
31+
32+
| Name of Dockerfile | Name of Image Pushed | Tags Available |
33+
|----|----|----|
34+
|matlab/Dockerfile | jupyter-matlab-notebook | r2023b, r2023a, r2022b, r2023b-ubuntu22.04, r2023a-ubuntu22.04, r2022b-ubuntu22.04 |
35+
|matlab/Dockerfile.byoi | jupyter-byoi-matlab-notebook | r2023b, r2023a, r2022b, r2023b-ubuntu22.04, r2023a-ubuntu22.04, r2022b-ubuntu22.04 |
36+
|matlab/Dockerfile.mounted | jupyter-mounted-matlab-notebook | r2023b, r2023a, r2022b, r2023b-ubuntu22.04, r2023a-ubuntu22.04, r2022b-ubuntu22.04 |
37+
|matlab/ubuntu20.04/Dockerfile | jupyter-matlab-notebook | r2023b-ubuntu20.04, r2023a-ubuntu20.04, r2020b-ubuntu20.04, r2020a-ubuntu20.04, r2021b-ubuntu20.04, r2021a-ubuntu20.04, r2020b-ubuntu20.04 |
38+
|matlab/ubuntu20.04/Dockerfile.byoi | jupyter-byoi-matlab-notebook | r2023b-ubuntu20.04, r2023a-ubuntu20.04, r2020b-ubuntu20.04, r2020a-ubuntu20.04, r2021b-ubuntu20.04, r2021a-ubuntu20.04, r2020b-ubuntu20.04 |
39+
|matlab/ubuntu20.04/Dockerfile.mounted | jupyter-mounted-matlab-notebook |r2023b-ubuntu20.04, r2023a-ubuntu20.04, r2020b-ubuntu20.04, r2020a-ubuntu20.04, r2021b-ubuntu20.04, r2021a-ubuntu20.04, r2020b-ubuntu20.04 |
40+
|matlab-vnc/Dockerfile | jupyter-matlab-vnc-notebook | r2023b, r2023a, r2022b, r2023b-ubuntu22.04, r2023a-ubuntu22.04, r2022b-ubuntu22.04 |
41+
|matlab-vnc/Dockerfile.mounted | jupyter-mounted-matlab-vnc-notebook | r2023b, r2023a, r2022b, r2023b-ubuntu22.04, r2023a-ubuntu22.04, r2022b-ubuntu22.04 |
42+
|matlab-vnc/ubuntu20.04/Dockerfile | jupyter-matlab-vnc-notebook | r2023b-ubuntu20.04, r2023a-ubuntu20.04, r2020b-ubuntu20.04, r2020a-ubuntu20.04, r2021b-ubuntu20.04, r2021a-ubuntu20.04, r2020b-ubuntu20.04 |
43+
|matlab-vnc/ubuntu20.04/Dockerfile.mounted | jupyter-mounted-matlab-vnc-notebook | r2023b-ubuntu20.04, r2023a-ubuntu20.04, r2020b-ubuntu20.04, r2020a-ubuntu20.04, r2021b-ubuntu20.04, r2021a-ubuntu20.04, r2020b-ubuntu20.04 |
44+
45+
Note: Pascal cased tags are also made available. ie: r2023a-ubuntu20.04 will also have a `R`2023a-ubuntu20.04
46+
47+
Each `reusable-workflow` job consists of the following steps:
48+
49+
1. Check-out the repository into a GitHub Actions runner.
50+
1. Setup Image Tags: Configures tags to have both Pascal & camel case tags (R2023a, r2023a)
51+
1. Login to DockerHub Container Registry
52+
1. Build the image & push
53+
1. If the variable "should_add_latest_tag" is present that an additional "latest" tag is added to the image.
54+
55+
----
56+
Copyright 2023 The MathWorks, Inc.
57+
----
Lines changed: 98 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,98 @@
1+
# Copyright 2023 The MathWorks, Inc.
2+
3+
name: Build and Publish the Container Image
4+
5+
# images build with this workflow are created with the following naming conventions:
6+
# ${base_image_name}:${matlab_release}-${os}
7+
8+
# built images are pushed to DockerHub. Note: Both camel & Pascal case versions of tags are generated and published
9+
10+
# This workflow is only be triggered when called from another workflow.
11+
on:
12+
workflow_call:
13+
inputs:
14+
docker_build_context:
15+
description: 'Relative path to folder with Dockerfile. Ex: ./matlab'
16+
required: true
17+
type: string
18+
base_image_name:
19+
description: 'Fully qualified name of image name'
20+
required: true
21+
type: string
22+
matlab_release_tag:
23+
description: 'Name of matlab release. Example: r2023a'
24+
required: true
25+
type: string
26+
os_info_tag:
27+
description: 'Allowed values: ubuntu20.04 ubuntu22.04'
28+
required: true
29+
type: string
30+
is_default_os:
31+
description: 'If true, then an additional tag without OS information is generated.'
32+
required: true
33+
type: boolean
34+
35+
jobs:
36+
build-push-image:
37+
runs-on: ubuntu-latest
38+
steps:
39+
- name: Checkout repo
40+
uses: actions/checkout@v3
41+
42+
- name : Setup Image Tags
43+
id: setup_image_tags
44+
run: |
45+
RAW_MATLAB_RELEASE=${{ inputs.matlab_release_tag }} \
46+
&& LOWER_CASE_MATLAB_RELEASE=${RAW_MATLAB_RELEASE,,} \
47+
&& echo "TAG_RELEASE_ONLY_CAMEL_CASE=${LOWER_CASE_MATLAB_RELEASE}" >> "$GITHUB_OUTPUT" \
48+
&& echo "TAG_RELEASE_ONLY_PASCAL_CASE=${LOWER_CASE_MATLAB_RELEASE^}" >> "$GITHUB_OUTPUT" \
49+
&& echo "TAG_RELEASE_AND_OS_CAMEL_CASE=${LOWER_CASE_MATLAB_RELEASE}-${{ inputs.os_info_tag }}" >> "$GITHUB_OUTPUT" \
50+
&& echo "TAG_RELEASE_AND_OS_PASCAL_CASE=${LOWER_CASE_MATLAB_RELEASE^}-${{ inputs.os_info_tag }}" >> "$GITHUB_OUTPUT"
51+
52+
# See here for example: https://docs.docker.com/build/ci/github-actions/push-multi-registries/
53+
# -
54+
# name: Login to Docker Hub
55+
# uses: docker/login-action@v2
56+
# with:
57+
# username: ${{ secrets.DOCKERHUB_USERNAME }}
58+
# password: ${{ secrets.DOCKERHUB_TOKEN }}
59+
60+
- name: Login to GitHub Container Registry
61+
uses: docker/login-action@v2
62+
with:
63+
registry: ghcr.io
64+
username: ${{ github.repository_owner }}
65+
password: ${{ secrets.GITHUB_TOKEN }}
66+
67+
- name: Set up Docker Buildx
68+
uses: docker/setup-buildx-action@v2
69+
70+
# Example tags: r2023a-ubuntu20.04, R2023a-ubuntu20.04
71+
- name: Build & Push Image
72+
if: ${{ inputs.is_default_os == false }}
73+
uses: docker/build-push-action@v4
74+
with:
75+
context: ${{ inputs.docker_build_context }}
76+
platforms: linux/amd64
77+
push: true
78+
tags: |
79+
${{ inputs.base_image_name }}:${{ steps.setup_image_tags.outputs.TAG_RELEASE_AND_OS_CAMEL_CASE }}
80+
${{ inputs.base_image_name }}:${{ steps.setup_image_tags.outputs.TAG_RELEASE_AND_OS_PASCAL_CASE }}
81+
build-args: MATLAB_RELEASE=${{ inputs.matlab_release_tag }}
82+
83+
# Example tags: r2023a-ubuntu20.04, R2023a-ubuntu20.04, r2023a, R2023a
84+
- name: Build & Push Image for latest OS
85+
if: ${{ inputs.is_default_os == true }}
86+
uses: docker/build-push-action@v4
87+
with:
88+
context: ${{ inputs.docker_build_context }}
89+
platforms: linux/amd64
90+
push: true
91+
tags: |
92+
${{ inputs.base_image_name }}:${{ steps.setup_image_tags.outputs.TAG_RELEASE_ONLY_CAMEL_CASE }}
93+
${{ inputs.base_image_name }}:${{ steps.setup_image_tags.outputs.TAG_RELEASE_ONLY_PASCAL_CASE }}
94+
${{ inputs.base_image_name }}:${{ steps.setup_image_tags.outputs.TAG_RELEASE_AND_OS_CAMEL_CASE }}
95+
${{ inputs.base_image_name }}:${{ steps.setup_image_tags.outputs.TAG_RELEASE_AND_OS_PASCAL_CASE }}
96+
build-args: MATLAB_RELEASE=${{ inputs.matlab_release_tag }}
97+
98+

.github/workflows/build-and-publish-dockerfiles.yml

Lines changed: 0 additions & 69 deletions
This file was deleted.
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
# Copyright 2023 The MathWorks, Inc.
2+
# Build & Publish matlab/Dockerfile.byoi
3+
name: matlab/Dockerfile.byoi
4+
5+
# Define when builds will occur:
6+
on:
7+
# Run workflow when there is a push to the 'main' branch & push includes changes to any files in described path
8+
push:
9+
branches:
10+
- 'main'
11+
paths:
12+
- 'matlab/Dockerfile.byoi'
13+
14+
# Run at 00:00 on every Monday (1st Day of the Week) (See: crontab.guru)
15+
schedule:
16+
- cron: '0 0 * * 1'
17+
18+
workflow_dispatch:
19+
20+
jobs:
21+
build-and-publish-docker-image:
22+
strategy:
23+
fail-fast: false
24+
matrix:
25+
matlab_release_tag: [r2023b, r2023a, r2022b]
26+
uses: ./.github/workflows/build-and-publish-docker-image.yml
27+
secrets: inherit
28+
with:
29+
docker_build_context: './matlab'
30+
base_image_name: ghcr.io/${{ github.repository }}/jupyter-byoi-matlab-notebook
31+
os_info_tag: 'ubuntu22.04'
32+
matlab_release_tag: ${{ matrix.matlab_release_tag }}
33+
is_default_os: true
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
# Copyright 2023 The MathWorks, Inc.
2+
# Build & Publish matlab/Dockerfile
3+
name: matlab/Dockerfile
4+
5+
# Define when builds will occur:
6+
on:
7+
# Run workflow when there is a push to the 'main' branch & push includes changes to any files in described path
8+
push:
9+
branches:
10+
- 'main'
11+
paths:
12+
- 'matlab/Dockerfile'
13+
14+
# Run at 00:00 on every Monday (1st Day of the Week) (See: crontab.guru)
15+
schedule:
16+
- cron: '0 0 * * 1'
17+
18+
workflow_dispatch:
19+
20+
jobs:
21+
build-and-publish-docker-image:
22+
strategy:
23+
fail-fast: false
24+
matrix:
25+
matlab_release_tag: [r2023b, r2023a, r2022b]
26+
uses: ./.github/workflows/build-and-publish-docker-image.yml
27+
secrets: inherit
28+
with:
29+
docker_build_context: './matlab'
30+
base_image_name: ghcr.io/${{ github.repository }}/jupyter-matlab-notebook
31+
os_info_tag: 'ubuntu22.04'
32+
matlab_release_tag: ${{ matrix.matlab_release_tag }}
33+
is_default_os: true
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
# Copyright 2023 The MathWorks, Inc.
2+
# Build & Publish matlab/Dockerfile.mounted
3+
name: matlab/Dockerfile.mounted
4+
5+
# Define when builds will occur:
6+
on:
7+
# Run workflow when there is a push to the 'main' branch & push includes changes to any files in described path
8+
push:
9+
branches:
10+
- 'main'
11+
paths:
12+
- 'matlab/Dockerfile.mounted'
13+
14+
# Run at 00:00 on every Monday (1st Day of the Week) (See: crontab.guru)
15+
schedule:
16+
- cron: '0 0 * * 1'
17+
18+
workflow_dispatch:
19+
20+
jobs:
21+
build-and-publish-docker-image:
22+
strategy:
23+
fail-fast: false
24+
matrix:
25+
matlab_release_tag: [r2023b, r2023a, r2022b]
26+
uses: ./.github/workflows/build-and-publish-docker-image.yml
27+
secrets: inherit
28+
with:
29+
docker_build_context: './matlab'
30+
base_image_name: ghcr.io/${{ github.repository }}/jupyter-mounted-matlab-notebook
31+
os_info_tag: 'ubuntu22.04'
32+
matlab_release_tag: ${{ matrix.matlab_release_tag }}
33+
is_default_os: true
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
# Copyright 2023 The MathWorks, Inc.
2+
# Build & Publish matlab/ubuntu20.04/Dockerfile.byoi
3+
name: matlab/ubuntu20.04/Dockerfile.byoi
4+
5+
# Define when builds will occur:
6+
on:
7+
# Run workflow when there is a push to the 'main' branch & push includes changes to any files in described path
8+
push:
9+
branches:
10+
- 'main'
11+
paths:
12+
- 'matlab/ubuntu20.04/Dockerfile.byoi'
13+
14+
# Run at 00:00 on every Monday (1st Day of the Week) (See: crontab.guru)
15+
schedule:
16+
- cron: '0 0 * * 1'
17+
18+
workflow_dispatch:
19+
20+
jobs:
21+
build-and-publish-docker-image:
22+
strategy:
23+
fail-fast: false
24+
matrix:
25+
matlab_release_tag: [r2023b, r2023a, r2022b, r2022a, r2021b, r2021a, r2020b]
26+
uses: ./.github/workflows/build-and-publish-docker-image.yml
27+
secrets: inherit
28+
with:
29+
docker_build_context: './matlab/ubuntu20.04'
30+
base_image_name: ghcr.io/${{ github.repository }}/jupyter-byoi-matlab-notebook
31+
os_info_tag: 'ubuntu20.04'
32+
matlab_release_tag: ${{ matrix.matlab_release_tag }}
33+
is_default_os: false

0 commit comments

Comments
 (0)