matlab-dockerfile
matlab-dockerfile copied to clipboard
Docker BuildKit Run Cache?
The older matlab installation could store the downloads in a BuildKit cache mount speeding up installation in cases where the Dockerfile changed and it wouldn't have to redownload everything.
Where does MPM store the downloads? It looks like everything goes to /tmp but it's not transparent how it downloads or if it will use existing files. Is there anything that describes how to keep that around, or is there a possible undocumented optimization (ie not removing the /tmp/<UUID> folders after installation?)
# syntax = docker/dockerfile:1.2
ARG MATLAB_RELEASE=r2021a
FROM mathworks/matlab:${MATLAB_RELEASE}
USER root
RUN apt-get update && apt-get install -yqq --no-install-recommends wget
ARG MATLAB_RELEASE
# Install required toolkits for MATLAB
# Specify the list of products to install using product names separated by spaces. Replace spaces within names with underscores.
RUN --mount=type=cache,id=matlab_download,target=/tmp,sharing=locked \
wget -q https://www.mathworks.com/mpm/glnxa64/mpm && \
chmod +x mpm && \
./mpm install \
--release=${MATLAB_RELEASE} \
--products MATLAB \
Statistics_and_Machine_Learning_Toolbox && \
rm -f /tmp/mathworks_root.log
USER matlab