-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update UBI Hardening images to include mpm and a MATLAB installation …
…archive
- Loading branch information
1 parent
6835663
commit f251ec6
Showing
6 changed files
with
112 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
# Copyright 2024 The MathWorks, Inc. | ||
ARG BASE_IMAGE | ||
|
||
ARG MPM_DOWNLOAD_DESTINATION="/usr/local/src" | ||
|
||
ARG MATLAB_RELEASE=R2024b | ||
|
||
ARG LOCATION_ROOT=/tmp/deps | ||
|
||
FROM ${BASE_IMAGE} as matlab-download | ||
|
||
ARG LOCATION_ROOT | ||
ARG MATLAB_RELEASE | ||
ARG MPM_DOWNLOAD_DESTINATION | ||
|
||
ARG DNF="dnf --disableplugin subscription-manager --assumeyes" | ||
RUN ${DNF} update && \ | ||
${DNF} install ca-certificates wget | ||
|
||
RUN wget -q https://www.mathworks.com/mpm/glnxa64/mpm && \ | ||
chmod +x mpm && \ | ||
./mpm download \ | ||
--release=${MATLAB_RELEASE} \ | ||
--destination=${MPM_DOWNLOAD_DESTINATION} \ | ||
--products MATLAB \ | ||
|| (echo "MPM Download Failure. See below for more information:" && cat /tmp/mathworks_root.log && false) | ||
|
||
ARG VERSION=v1.x | ||
|
||
RUN mkdir -p ${LOCATION_ROOT} && \ | ||
sha256sum ${MPM_DOWNLOAD_DESTINATION}/ProductFilesInfo.xml > ${LOCATION_ROOT}/matlab.sha256 && \ | ||
echo "${VERSION}" > ${LOCATION_ROOT}/matlab.version | ||
|
||
# Move MPM and the installation files to a scratch image | ||
FROM scratch | ||
|
||
LABEL maintainer="The MathWorks, Inc." | ||
|
||
# Declare build arguments to use at the current build stage. | ||
ARG MPM_DOWNLOAD_DESTINATION | ||
ARG LOCATION_ROOT | ||
|
||
COPY --from=matlab-download ${MPM_DOWNLOAD_DESTINATION} / | ||
COPY --from=matlab-download mpm /mpm | ||
COPY --from=matlab-download ${LOCATION_ROOT}/*.sha256 / | ||
COPY --from=matlab-download ${LOCATION_ROOT}/*.version / |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
# Copyright 2024 The MathWorks, Inc. | ||
|
||
""" | ||
Module for testing the "matlab" image | ||
""" | ||
|
||
from utils import basetest | ||
import unittest | ||
|
||
|
||
class MATLABTest(basetest.TestCase): | ||
""" | ||
Test class to build a Docker image from the "matlab" one and test the resulting image | ||
""" | ||
dockerfile = "Dockerfile.matlab" | ||
|
||
def test_matlab_present(self): | ||
"""Test that MATLAB is installed and available""" | ||
self.assertTrue(self.host.exists(command="matlab")) | ||
|
||
|
||
################################################################################## | ||
|
||
if __name__ == "__main__": | ||
unittest.main() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
# Copyright 2023-2024 The MathWorks, Inc. | ||
|
||
ARG BASE_REGISTRY=redhat | ||
ARG BASE_IMAGE=ubi9 | ||
ARG BASE_TAG=9.4 | ||
ARG IMAGE_UNDER_TEST=matlab | ||
|
||
FROM ${IMAGE_UNDER_TEST} AS image-under-test | ||
|
||
FROM ${BASE_REGISTRY}/${BASE_IMAGE}:${BASE_TAG} | ||
|
||
ARG MATLAB_INSTALL_LOCATION=/opt/matlab | ||
|
||
COPY --from=image-under-test / /matlab-archive | ||
|
||
RUN /matlab-archive/mpm install \ | ||
--source=/matlab-archive/archives \ | ||
--destination=${MATLAB_INSTALL_LOCATION} \ | ||
--products MATLAB \ | ||
|| (echo "MPM Installation Failure. See below for more information:" && cat /tmp/mathworks_root.log && false) \ | ||
&& rm -rf /tmp/mathworks_root.log \ | ||
&& ln -s ${MATLAB_INSTALL_LOCATION}/bin/matlab /usr/local/bin/matlab |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters