mathworks-ref-arch/matlab-dockerfile

Question: Support Package installation location

Closed this issue · 2 comments

Hi!

I think the support package installation support is a great new addition for MPM. Kudos to the team working on this.
I have some demo setups for CI/CD Automation for Simulink Check.
I am not sure if my Docker build process proper or not with MPM. However, as I understand when I install the support package then it gets placed under /root /Documents/MATLAB/R${MATLAB_VERSION}.

I am not sure if this is the reason or not, but when I test the built image it does not find the support package that I have installed (using mpm).

I added a step where it copies the folder from /root to /home/matlab/Documents/MATLAB/...

RUN mkdir -p /home/matlab/Documents/MATLAB/SupportPackages/ \
    && chown -R matlab:matlab /home/matlab/ \
    && cp -a /root/Documents/MATLAB/SupportPackages/. /home/matlab/Documents/MATLAB/SupportPackages/ \
    && rm -rf /root/Documents/MATLAB/

I have a feeling that I missed something obvious. I can setup a quick example if needed. I just wanted to put this discussion up first before I forget it.

Hi @gamlab-jlin,

This is likely being caused by the fact the MATLAB (and support packages) are being installed using sudo. To make sure that the support packages are installed in the correct location the $HOME environment variable must be passed the installation command. This should produce something of the following form:

RUN sudo HOME=${HOME} ./mpm install \
    --release=${MATLAB_RELEASE} \
    --destination=${MATLAB_INSTALL_LOCATION} \
    --products ${MATLAB_PRODUCT_LIST}

This should be included in the example Dockerfile provided, you may have to update your local copy to see this.

Hopefully this solves the issue you are seeing

Hi @michaelmcdonnellmw,

Thank you for the quick heads-up. I think you are right, my legacy Dockerfile has been swapping to root user before mpm.
I see that the current Dockerfiles now use the MATLAB user to install using mpm. I believe this is a cleaner process.

I think this should address the issue, I will test it in a bit. Thank you for your support!