forked from mathworks-ref-arch/matlab-dockerfile
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
executable file
·68 lines (57 loc) · 3.12 KB
/
Copy pathDockerfile
File metadata and controls
executable file
·68 lines (57 loc) · 3.12 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
# Copyright 2019 - 2022 The MathWorks, Inc.
# To specify which MATLAB release to install in the container, edit the value of the MATLAB_RELEASE argument.
# Use lower case to specify the release, for example: ARG MATLAB_RELEASE=r2021b
ARG MATLAB_RELEASE=r2022a
# When you start the build stage, this Dockerfile by default uses the Ubuntu-based matlab-deps image.
# To check the available matlab-deps images, see: https://hub.docker.com/r/mathworks/matlab-deps
FROM mathworks/matlab-deps:${MATLAB_RELEASE}
# Declare the global argument to use at the current build stage
ARG MATLAB_RELEASE
# Install mpm dependencies
RUN export DEBIAN_FRONTEND=noninteractive && apt-get update && \
apt-get install --no-install-recommends --yes \
wget \
unzip \
ca-certificates && \
apt-get clean && apt-get autoremove
# Run mpm to install MATLAB in the target location and delete the mpm installation afterwards.
# If mpm fails to install successfully then output the logfile to the terminal, otherwise cleanup.
RUN wget -q https://www.mathworks.com/mpm/glnxa64/mpm && \
chmod +x mpm && \
./mpm install \
--release=${MATLAB_RELEASE} \
--destination=/opt/matlab \
--products MATLAB || \
(echo "MPM Installation Failure. See below for more information:" && cat /tmp/mathworks_root.log && false) && \
rm -f mpm /tmp/mathworks_root.log && \
ln -s /opt/matlab/bin/matlab /usr/local/bin/matlab
# Add "matlab" user and grant sudo permission.
RUN adduser --shell /bin/bash --disabled-password --gecos "" matlab && \
echo "matlab ALL=(ALL) NOPASSWD: ALL" > /etc/sudoers.d/matlab && \
chmod 0440 /etc/sudoers.d/matlab
# One of the following 2 ways of configuring the license server to use must be
# uncommented.
ARG LICENSE_SERVER
# Specify the host and port of the machine that serves the network licenses
# if you want to bind in the license info as an environment variable. This
# is the preferred option for licensing. It is either possible to build with
# something like --build-arg LICENSE_SERVER=27000@MyServerName, alternatively
# you could specify the license server directly using
# ENV MLM_LICENSE_FILE=27000@flexlm-server-name
ENV MLM_LICENSE_FILE=$LICENSE_SERVER
# Alternatively you can put a license file into the container.
# You should fill this file out with the details of the license
# server you want to use and uncomment the following line.
# COPY network.lic /opt/matlab/licenses/
# The following environment variables allow MathWorks to understand how this MathWorks
# product (MATLAB Dockerfile) is being used. This information helps us make MATLAB even better.
# Your content, and information about the content within your files, is not shared with MathWorks.
# To opt out of this service, delete the environment variables defined in the following line.
# See the Help Make MATLAB Even Better section in the accompanying README to learn more:
# https://github.com/mathworks-ref-arch/matlab-dockerfile#help-make-matlab-even-better
ENV MW_DDUX_FORCE_ENABLE=true MW_CONTEXT_TAGS=MATLAB:DOCKERFILE:V1
# Set user and work directory
USER matlab
WORKDIR /home/matlab
ENTRYPOINT ["matlab"]
CMD [""]