mathworks-ref-arch / matlab-dockerfile

Create a docker container that contains a MATLAB install
Other
345 stars 96 forks source link

Allow name=value syntax for --no-gpu argument #110

Closed CiaranMcAndrew1 closed 5 months ago

CiaranMcAndrew1 commented 5 months ago

Trying to write a single Dockerfile that can accommodate multiple build options via arguments. The mpm --no-gpu flag is hard to work around without having to do either some conditional logic and code repetition, or some dynamic code evaluation which is rightly frowned up.

Example:

ARG no_gpu=false
RUN if [[ $no_gpu == false ]]; then
           mpm --no-gpu ....
        else
           mpm ....
        fi

This combined with the existing complexity around mpm calls leads to some not-very-nice Dockerfiles.

If the --no-gpu option was a name=value argument instead, with a default true when present, this would greatly simplify the callability, and preserve backwards compatibility. It would also be consistent with existing mpm arguments.

mpm --no-gpu=true same as mpm --no-gpu.

mpm --no-gpu=false same as mpm.