Skip to content

Commit 5f6a7c9

Browse files
michaelmcdonnellmwepaganon
authored andcommitted
Pin ubuntu and gcc/g++ versions for mathworks/matlab base images
1 parent a3899c6 commit 5f6a7c9

File tree

6 files changed

+62
-11
lines changed

6 files changed

+62
-11
lines changed

matlab/Dockerfile

Lines changed: 18 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Copyright 2024 The MathWorks, Inc.
1+
# Copyright 2024-2025 The MathWorks, Inc.
22

33
# This Dockerfile allows you to build either the MATLAB Container image or the MATLAB Deep Learning Container image.
44

@@ -15,26 +15,35 @@ ARG MPM_ADDITIONAL_FLAGS=""
1515
# Specify the base repository to pull MATLAB dependencies from.
1616
ARG MATLAB_DEPS_IMAGE=""
1717

18+
# Pin to a specific Ubuntu version to ensure images can be updated independently of defaults for matlab-deps.
19+
# Should be a ubuntu-based image e.g. `ubuntu20.04`
20+
# Leave blank to use the default OS
21+
ARG MATLAB_DEPS_OS=""
22+
1823
# Specify the URL of the managed version of MathWorks Service Host.
1924
ARG MATHWORKS_SERVICE_HOST_INSTALL_URL=""
2025

2126
# Specify any additional packages to install via apt-get.
2227
ARG APT_ADDITIONAL_PACKAGES=""
2328
ARG APT_ADDITIONAL_PACKAGES_VNC=""
2429

30+
ARG GCC=""
31+
ARG GPP=""
32+
2533
# Specify MATLAB Install Location.
2634
ARG MATLAB_INSTALL_LOCATION="/opt/matlab/${MATLAB_RELEASE}"
2735

2836
# When you start the build stage, this Dockerfile by default uses the Ubuntu-based matlab-deps image.
2937
# To check the available matlab-deps images, see: https://hub.docker.com/r/mathworks/matlab-deps
30-
FROM ${MATLAB_DEPS_IMAGE}:${MATLAB_RELEASE} AS build
31-
38+
FROM ${MATLAB_DEPS_IMAGE}:${MATLAB_RELEASE}${MATLAB_DEPS_OS:+-$MATLAB_DEPS_OS} AS build
3239
ARG MATLAB_RELEASE
3340
ARG MATLAB_INSTALL_LOCATION
3441
ARG MPM_ADDITIONAL_FLAGS
3542
ARG MATHWORKS_SERVICE_HOST_INSTALL_URL
3643
ARG APT_ADDITIONAL_PACKAGES
3744
ARG APT_ADDITIONAL_PACKAGES_VNC
45+
ARG GCC
46+
ARG GPP
3847

3948
# Install extra tools not included in `matlab-deps`.
4049
RUN export DEBIAN_FRONTEND=noninteractive \
@@ -44,8 +53,8 @@ RUN export DEBIAN_FRONTEND=noninteractive \
4453
# Requirements for mpm
4554
ca-certificates \
4655
# Requirements for mex generation
47-
gcc \
48-
g++ \
56+
${GCC} \
57+
${GPP} \
4958
# Requirements for VNC
5059
libglu1-mesa \
5160
libosmesa6 \
@@ -75,6 +84,10 @@ RUN export DEBIAN_FRONTEND=noninteractive \
7584
&& apt-get -y autoremove \
7685
&& rm -rf /var/lib/apt/lists/*
7786

87+
# Set the gcc and g++ soft links
88+
RUN ln -s $(which ${GCC}) /usr/bin/gcc && \
89+
ln -s $(which ${GPP}) /usr/bin/g++
90+
7891
################################################################################
7992
# Setup VNC
8093
################################################################################

matlab/docker-bake.hcl

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Copyright 2024 The MathWorks, Inc.
1+
# Copyright 2024-2025 The MathWorks, Inc.
22

33
# General Configuration variables
44

@@ -10,6 +10,10 @@ variable "MATLAB_RELEASE" {
1010
default = "${LATEST_RELEASE}"
1111
}
1212

13+
variable "MATLAB_DEPS_OS" {
14+
default = "ubuntu22.04"
15+
}
16+
1317
variable "MPM_ADDITIONAL_FLAGS" {
1418
default = ""
1519
}
@@ -28,17 +32,30 @@ variable "APT_ADDITIONAL_PACKAGES_VNC" {
2832
default = "tigervnc-tools"
2933
}
3034

35+
variable "GCC" {
36+
# By default, this should match the version of gcc required by the latest MATLAB release.
37+
default = "gcc-12"
38+
}
39+
40+
variable "GPP" {
41+
# By default, this should match the version of g++ required by the latest MATLAB release.
42+
default = "g++-12"
43+
}
44+
3145
variable "MATHWORKS_SERVICE_HOST_INSTALL_URL" {
3246
default = "https://www.mathworks.com/MathWorksServiceHost/glnxa64/install_managed_msh.sh"
3347
}
3448

3549
variable "common_args" {
3650
default = {
3751
MATLAB_DEPS_IMAGE = "${MATLAB_DEPS_IMAGE}"
52+
MATLAB_DEPS_OS = "${MATLAB_DEPS_OS}"
3853
MATLAB_RELEASE = "${MATLAB_RELEASE}"
3954
MPM_ADDITIONAL_FLAGS = "${MPM_ADDITIONAL_FLAGS}"
4055
APT_ADDITIONAL_PACKAGES = "${APT_ADDITIONAL_PACKAGES}"
4156
APT_ADDITIONAL_PACKAGES_VNC = "${APT_ADDITIONAL_PACKAGES_VNC}"
57+
GCC = "${GCC}"
58+
GPP = "${GPP}"
4259
MATHWORKS_SERVICE_HOST_INSTALL_URL = "${MATHWORKS_SERVICE_HOST_INSTALL_URL}"
4360
}
4461
}

matlab/release-config/R2023a.env.hcl

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,15 @@
1-
# Copyright 2024 The MathWorks, Inc.
1+
# Copyright 2024-2025 The MathWorks, Inc.
22

33
MATLAB_RELEASE="R2023a"
44

5+
MATLAB_DEPS_OS="ubuntu20.04"
6+
7+
# Using gcc-9 instead of gcc-11 as it is not available on Ubuntu 20.04
8+
GCC="gcc-9"
9+
GPP="g++-9"
10+
511
# Ubuntu 20.04 requires python3.8-venv when using pipx
612
APT_ADDITIONAL_PACKAGES="python3.8-venv"
713

814
# Ubuntu 20.04 has vncpasswd provided by tigervnc-common so don't need tigervnc-tools
9-
APT_ADDITIONAL_PACKAGES_VNC=""
15+
APT_ADDITIONAL_PACKAGES_VNC=""

matlab/release-config/R2023b.env.hcl

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1-
# Copyright 2024 The MathWorks, Inc.
1+
# Copyright 2024-2025 The MathWorks, Inc.
22

33
MATLAB_RELEASE="R2023b"
4+
5+
MATLAB_DEPS_OS="ubuntu22.04"
6+
7+
GCC="gcc-11"
8+
GPP="g++-11"

matlab/release-config/R2024a.env.hcl

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1-
# Copyright 2024 The MathWorks, Inc.
1+
# Copyright 2024-2025 The MathWorks, Inc.
22

33
MATLAB_RELEASE="R2024a"
4+
5+
MATLAB_DEPS_OS="ubuntu22.04"
6+
7+
GCC="gcc-12"
8+
GPP="g++-12"

matlab/release-config/R2024b.env.hcl

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1-
# Copyright 2024 The MathWorks, Inc.
1+
# Copyright 2024-2025 The MathWorks, Inc.
22

33
MATLAB_RELEASE="R2024b"
4+
5+
MATLAB_DEPS_OS="ubuntu22.04"
6+
7+
GCC="gcc-12"
8+
GPP="g++-12"

0 commit comments

Comments
 (0)