How mathworks-ref-arch/matlab-dockerfile works
This project is a repository dedicated to building and customizing Docker container images for MATLAB. Its core purpose is to demonstrate several approaches to containerizing MATLAB and its toolboxes using Docker, with an emphasis on reproducibility and scalability via the MATLAB Package Manager (mpm) as well as alternative installation methods (MATLAB installer, building on top of an existing image, offline installation, and non-interactive usage).
Main Components
• Docker Build Process & Core Dockerfile:
• Top-level Dockerfile used for the standard MATLAB container image build.
• Key build arguments (MATLAB_RELEASE, MATLAB_PRODUCT_LIST, MATLAB_INSTALL_LOCATION, LICENSE_SERVER) that define customization parameters.
• Alternative Build Methods:
• “alternates” folder as a branch of the system that contains Dockerfiles for different workflows:
• matlab-installer (using the native MATLAB installer instead of mpm)
• building-on-matlab-docker-image (building on an existing MATLAB image from Docker Hub)
• matlab-container-offline-install (for offline environments)
• non-interactive (suitable for CI/CD pipelines with batch licensing)
• Input Files & Testing:
• Mpm-input-files directory, which holds version-specific input configuration files for the MATLAB Package Manager.
• Tests folder, which contains test suites and scripts (in various languages such as MATLAB scripts, Python tests, and shell/PowerShell installers) that verify container behavior and installation integrity.
• CI/CD Workflow:
• The .github/workflows directory should be depicted as part of the automation pipeline which runs build, test, and publish steps.
• Directional flows from code push/PR triggers to running these GitHub Actions.
Relationships and Interactions
• How the source repository (Dockerfiles, alternates, and mpm-input-files) is used to perform Docker builds.
• Dynamic relationship where build-time arguments customize the container image and how the different Dockerfiles provide alternative build routes.
• External dependency on a Network License Manager (or license file input) that interacts with the container at run-time via environment variables or file copies.
• That CI/CD workflows integrate with Docker to ensure each container variant is built, tested, and validated.
Architectural Patterns & Design Principles
• Modularity by showing the separation between different installation methods (mpm vs MATLAB installer) under “alternates.”
• Layering concept: a base container image (via Dockerfile) can be extended with additional toolboxes.
• Convey scalability and reproducibility principles through clear, configurable build parameters.
• Incorporate the continuous integration cycle (triggered by GitHub workflows) that acts upon code changes.
• Summarize input configurations and testing as supporting modules that ensure the container image meets requirements before deployment.