Skip to content

Commit cd59916

Browse files
authored
Switch to Calkit pipeline (#1)
1 parent 0886582 commit cd59916

6 files changed

Lines changed: 241 additions & 23 deletions

File tree

.calkit/env-locks/matlab.json

Lines changed: 94 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,94 @@
1+
[
2+
{
3+
"RepoTags": [
4+
"matlab:r2024b-e5b33f72"
5+
],
6+
"Parent": "",
7+
"Comment": "buildkit.dockerfile.v0",
8+
"Created": "2025-06-04T21:05:19.237315417Z",
9+
"Author": "",
10+
"Config": {
11+
"User": "matlab",
12+
"ExposedPorts": {
13+
"5901/tcp": {},
14+
"6080/tcp": {},
15+
"8888/tcp": {}
16+
},
17+
"Env": [
18+
"PATH=/home/matlab/.local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin",
19+
"MW_SERVICEHOST_USE_HOSTNAME_FOR_PERSISTENCE=false",
20+
"MWI_ENABLE_TOKEN_AUTH=False",
21+
"MWI_APP_PORT=8888",
22+
"MW_DDUX_FORCE_ENABLE=true",
23+
"MW_CONTEXT_TAGS=MATLAB:DOCKERHUB:V1,MATLAB:TOOLBOXES:DOCKERFILE:V1",
24+
"MHLM_CONTEXT=MATLAB_DOCKERHUB"
25+
],
26+
"Entrypoint": [
27+
"tini",
28+
"--",
29+
"/bin/run.sh"
30+
],
31+
"WorkingDir": "/home/matlab",
32+
"Labels": {
33+
"maintainer": "The MathWorks, Inc.",
34+
"org.opencontainers.image.ref.name": "ubuntu",
35+
"org.opencontainers.image.version": "22.04"
36+
},
37+
"ArgsEscaped": true
38+
},
39+
"Architecture": "amd64",
40+
"Os": "linux",
41+
"Size": 4651859839,
42+
"GraphDriver": {
43+
"Data": null,
44+
"Name": "overlayfs"
45+
},
46+
"RootFS": {
47+
"Type": "layers",
48+
"Layers": [
49+
"sha256:346f14bf17b9846c3e67362b00c16c9085772033cb7c58742c4e1efa22466d38",
50+
"sha256:af43eebcc94902c293e27c8e6423022866445278b832353d8ffe8333787f39a1",
51+
"sha256:f08b30854602b1a2d9b2f4458315cec0b428986708b21cd84db6f73cb0787a4a",
52+
"sha256:5f70bf18a086007016e948b04aed3b82103a36bea41755b6cddfaf10ace3c6ef",
53+
"sha256:c35124c1e0d7ca642132bf9116140f2e937d7b4a78f2827ba77c703e3ef5e6e8",
54+
"sha256:013a6807d52bc3c8e3b4c2a8acffa5101c1922f37130f26f4d527be9d89f2288",
55+
"sha256:be6f33ad7f4f1b1d75e0dceaec11b00814ae482d4d16186074881061fda620e6",
56+
"sha256:ec2f15ecfdc639336430649ec69bd860ee0360cb91b6d08b5b7ed7f12e39cba2",
57+
"sha256:d6b0c10807489b70e9328b8055c5eb756e01fbd7af59f13e902c4f2c99dfb7a3",
58+
"sha256:6fd284107866999fb9bf70fa3e68f65198189afc2344ba6c8ae6b9dcaf8596ee",
59+
"sha256:0bcf7e6b979b082b41c4cc79b9884de1f1bc7a10ce80644f85f6a36073edf6bb",
60+
"sha256:03ac6c35e2ec9c9cfe427d79bfb254ccc029768cd5e1b8f70c8ef46e7a689746",
61+
"sha256:93cee93b357796632eae898b7c5cf2bea7f3d8c97fcc1094dd93f4305b4c6579",
62+
"sha256:310b2e978ec3cf4224dd419d4e5e1274e381bdad73359fecc523986141e31507",
63+
"sha256:b0450a925631ecab6c83e5a98017f35f17f9560d214cf6360466b47492dad424",
64+
"sha256:d22641ce50a797daac63aeb759b4712e106777b39b14a4ee8684d06115730e1b",
65+
"sha256:590d8ec008d0fc8292eea5aa1c96d520a0c72092bd70cdbea0e7dcda87bdd210",
66+
"sha256:5f70bf18a086007016e948b04aed3b82103a36bea41755b6cddfaf10ace3c6ef",
67+
"sha256:a5e7e9393e53480ab7452ae66a5a38f902f23d53a9123add3aa4fe770cbaebbf",
68+
"sha256:677ed8b7975ca61d616cc6e94778a434659cef40be17a3c1580ba420fb7f1fe4",
69+
"sha256:7c2b93e34c3387f3470e7d2ed1d1396a8867477f3fcaf47449ee1dfcb1926433",
70+
"sha256:6689fcd4d8edd31a63bdb233b65cdf9320ec02aad780a3bee1ae25f6f8fe576b",
71+
"sha256:e7ba9f6ee27ca909795e3d741d0e6e2ea5c40970e898a2d1e729077312a4d61d",
72+
"sha256:aa50be58d88a752dffdf3a5d0b2df7db1d5433ee31d6a84371ce12f1c7d498aa",
73+
"sha256:86db38688d71dd5142fb9f36091d8e11d34f3aea29ee2201dd88d842b5db2380",
74+
"sha256:f1280182c8c5ab31bae78a194b31759de29a214ae37df5e02b1c33b2d94d5f11",
75+
"sha256:1f5483cf6ca5444fae425dd7864480c47876289f41ef7c1497b54beef8a1a3ca",
76+
"sha256:784e14ca7b33899c67098a59405b6d423290d4990a82cc7fdaf578ef46b8c71f",
77+
"sha256:46574fdb719f0d88c524957ff128737c9b07f4e197abc9bfd001a5d638c2730f",
78+
"sha256:2ea6ef8fc3cf8480ee26165927718b298223752a0172c2e4b1a77af13d338016",
79+
"sha256:5f70bf18a086007016e948b04aed3b82103a36bea41755b6cddfaf10ace3c6ef",
80+
"sha256:a13eacfb1ec365aa40ff380bf7ae4a97f789158d7230c9d477b2291d0665de75",
81+
"sha256:5f70bf18a086007016e948b04aed3b82103a36bea41755b6cddfaf10ace3c6ef",
82+
"sha256:3966f698dced15e796f1143904adff113bd520c7ab759fae7200187ed9405fa3",
83+
"sha256:5f70bf18a086007016e948b04aed3b82103a36bea41755b6cddfaf10ace3c6ef"
84+
]
85+
},
86+
"Descriptor": {
87+
"mediaType": "application/vnd.oci.image.index.v1+json",
88+
"digest": "sha256:d7ee331fd136cace7f356c793d12736b714185c462a2e655845d0ed42f78e3be",
89+
"size": 856
90+
},
91+
"DockerfileMD5": "49563e914bf7401c0d1dcfb98a081002",
92+
"DepsMD5s": {}
93+
}
94+
]
Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
# Copyright 2023-2025 The MathWorks, Inc.
2+
3+
# To specify which MATLAB release to install in the container, edit the value of the MATLAB_RELEASE argument.
4+
# Use uppercase to specify the release, for example: ARG MATLAB_RELEASE=R2021b
5+
ARG MATLAB_RELEASE=R2024b
6+
7+
# Specify the extra products to install into the image. These products can either be toolboxes or support packages.
8+
# This is a space delimited list with each product having underscores and capitalized names
9+
ARG ADDITIONAL_PRODUCTS="Statistics_and_Machine_Learning_Toolbox Parallel_Computing_Toolbox"
10+
11+
# This Dockerfile builds on the Ubuntu-based mathworks/matlab image.
12+
# To check the available matlab images, see: https://hub.docker.com/r/mathworks/matlab
13+
FROM mathworks/matlab:$MATLAB_RELEASE
14+
15+
# Declare the global argument to use at the current build stage
16+
ARG MATLAB_RELEASE
17+
ARG ADDITIONAL_PRODUCTS
18+
19+
# By default, the MATLAB container runs as user "matlab". To install mpm dependencies, switch to root.
20+
USER root
21+
22+
# Install mpm dependencies
23+
RUN export DEBIAN_FRONTEND=noninteractive \
24+
&& apt-get update \
25+
&& apt-get install --no-install-recommends --yes \
26+
wget \
27+
ca-certificates \
28+
&& apt-get clean \
29+
&& apt-get autoremove \
30+
&& rm -rf /var/lib/apt/lists/*
31+
32+
# Run mpm to install MathWorks products into the existing MATLAB installation directory,
33+
# and delete the mpm installation afterwards.
34+
# Modify it by setting the ADDITIONAL_PRODUCTS defined above,
35+
# e.g. ADDITIONAL_PRODUCTS="Statistics_and_Machine_Learning_Toolbox Parallel_Computing_Toolbox MATLAB_Coder".
36+
# If mpm fails to install successfully then output the logfile to the terminal, otherwise cleanup.
37+
38+
# Switch to user matlab, and pass in $HOME variable to mpm,
39+
# so that mpm can set the correct root folder for the support packages.
40+
41+
WORKDIR /tmp
42+
USER matlab
43+
RUN wget -q https://www.mathworks.com/mpm/glnxa64/mpm \
44+
&& chmod +x mpm \
45+
&& EXISTING_MATLAB_LOCATION=$(dirname $(dirname $(readlink -f $(which matlab)))) \
46+
&& sudo HOME=${HOME} ./mpm install \
47+
--destination=${EXISTING_MATLAB_LOCATION} \
48+
--release=${MATLAB_RELEASE} \
49+
--products ${ADDITIONAL_PRODUCTS} \
50+
|| (echo "MPM Installation Failure. See below for more information:" && cat /tmp/mathworks_root.log && false) \
51+
&& sudo rm -rf mpm /tmp/mathworks_root.log
52+
53+
54+
# When running the container a license file can be mounted,
55+
# or a license server can be provided as an environment variable.
56+
# For more information, see https://hub.docker.com/r/mathworks/matlab
57+
58+
# Alternatively, you can provide a license server to use
59+
# with the docker image while building the image.
60+
# Specify the host and port of the machine that serves the network licenses
61+
# if you want to bind in the license info as an environment variable.
62+
# You can also build with something like --build-arg LICENSE_SERVER=27000@MyServerName,
63+
# in which case you should uncomment the following two lines.
64+
# If these lines are uncommented, $LICENSE_SERVER must be a valid license
65+
# server or browser mode will not start successfully.
66+
# ARG LICENSE_SERVER
67+
# ENV MLM_LICENSE_FILE=$LICENSE_SERVER
68+
69+
# The following environment variables allow MathWorks to understand how this MathWorks
70+
# product is being used. This information helps us make MATLAB even better.
71+
# Your content, and information about the content within your files, is not shared with MathWorks.
72+
# To opt out of this service, delete the environment variables defined in the following line.
73+
# See the Help Make MATLAB Even Better section in the accompanying README to learn more:
74+
# https://github.com/mathworks-ref-arch/matlab-dockerfile#help-make-matlab-even-better
75+
ENV MW_DDUX_FORCE_ENABLE=true MW_CONTEXT_TAGS=$MW_CONTEXT_TAGS,MATLAB:TOOLBOXES:DOCKERFILE:V1
76+
77+
WORKDIR /home/matlab
78+
# Inherit ENTRYPOINT and CMD from base image.

.gitignore

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,4 @@
1-
scratch.m
1+
scratch.m
2+
.DS_Store
3+
4+
.env

calkit.yaml

Lines changed: 23 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,29 @@ title: MATLAB example
22
description: >
33
This project shows how to incorporate MATLAB into a reproducible
44
research project.
5-
dependencies:
6-
- matlab
5+
environments:
6+
matlab:
7+
kind: matlab
8+
version: R2024b
9+
products:
10+
- Statistics_and_Machine_Learning_Toolbox
11+
- Parallel_Computing_Toolbox
12+
pipeline:
13+
stages:
14+
collect-data:
15+
kind: matlab-script
16+
environment: matlab
17+
script_path: scripts/collect_data.m
18+
outputs:
19+
- data/raw/data.parquet
20+
plot-data:
21+
kind: matlab-script
22+
environment: matlab
23+
script_path: scripts/plot_data.m
24+
outputs:
25+
- figures/plot.png
26+
inputs:
27+
- data/raw/data.parquet
728
datasets:
829
- path: data/raw/data.parquet
930
title: Raw data

dvc.lock

Lines changed: 30 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -13,30 +13,52 @@ stages:
1313
md5: 0b2be6aa89192942ea0e1263f9f7e55c
1414
size: 384
1515
plot-data:
16-
cmd: matlab -noFigureWindows -batch "run('scripts/plot_data.m');"
16+
cmd: calkit xenv -n matlab --no-check -- "run('scripts/plot_data.m');"
1717
deps:
18+
- path: .calkit/env-locks/matlab.json
19+
hash: md5
20+
md5: 074a6771582255a621b5fda8cb2cc2d3
21+
size: 5082
1822
- path: data/raw/data.parquet
1923
hash: md5
2024
md5: 7d4fadae29fbf5fdf9eedc81a9f0cc9e
2125
size: 9853
2226
- path: scripts/plot_data.m
2327
hash: md5
24-
md5: c8b93dbaeeafd299f590282687fa58fa
25-
size: 148
28+
md5: dd5ffb54107b06b64d0f3fb5be4429f9
29+
size: 144
2630
outs:
2731
- path: figures/plot.png
2832
hash: md5
29-
md5: e4d326bd882b78d8e00cd8f3ea761259
30-
size: 20609
33+
md5: 0459648a57a7fd45c8264e4902a15494
34+
size: 79715
3135
collect-data:
32-
cmd: matlab -batch "run('scripts/collect_data.m');"
36+
cmd: calkit xenv -n matlab --no-check -- "run('scripts/collect_data.m');"
3337
deps:
38+
- path: .calkit/env-locks/matlab.json
39+
hash: md5
40+
md5: 074a6771582255a621b5fda8cb2cc2d3
41+
size: 5082
3442
- path: scripts/collect_data.m
3543
hash: md5
36-
md5: 2f8b10c1bed030b42cbca5c50cb15063
37-
size: 146
44+
md5: e9f0c4b4277e253b9034dbc7e5495058
45+
size: 142
3846
outs:
3947
- path: data/raw/data.parquet
4048
hash: md5
4149
md5: 7d4fadae29fbf5fdf9eedc81a9f0cc9e
4250
size: 9853
51+
_check_env_matlab:
52+
cmd: calkit check matlab-env --name matlab --output .calkit/env-locks/matlab.json
53+
outs:
54+
- path: .calkit/env-locks/matlab.json
55+
hash: md5
56+
md5: 71c8f7b71fac0c8a028a0b11a25cb685
57+
size: 806
58+
_check-env-matlab:
59+
cmd: calkit check matlab-env --name matlab --output .calkit/env-locks/matlab.json
60+
outs:
61+
- path: .calkit/env-locks/matlab.json
62+
hash: md5
63+
md5: 074a6771582255a621b5fda8cb2cc2d3
64+
size: 5082

dvc.yaml

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,24 @@
11
stages:
2+
_check-env-matlab:
3+
cmd: calkit check matlab-env --name matlab --output .calkit/env-locks/matlab.json
4+
deps: []
5+
outs:
6+
- .calkit/env-locks/matlab.json:
7+
cache: false
8+
persist: true
9+
always_changed: true
210
collect-data:
3-
cmd: matlab -batch "run('scripts/collect_data.m');"
11+
cmd: calkit xenv -n matlab --no-check -- "run('scripts/collect_data.m');"
412
deps:
513
- scripts/collect_data.m
14+
- .calkit/env-locks/matlab.json
615
outs:
716
- data/raw/data.parquet
8-
meta:
9-
calkit:
10-
type: dataset
11-
title: Raw data
12-
description: The raw data from the experiment.
1317
plot-data:
14-
cmd: matlab -noFigureWindows -batch "run('scripts/plot_data.m');"
18+
cmd: calkit xenv -n matlab --no-check -- "run('scripts/plot_data.m');"
1519
deps:
1620
- scripts/plot_data.m
1721
- data/raw/data.parquet
22+
- .calkit/env-locks/matlab.json
1823
outs:
1924
- figures/plot.png
20-
meta:
21-
calkit:
22-
type: figure
23-
title: The plot
24-
description: The plot.

0 commit comments

Comments
 (0)