From 369e0a71a1590c768cc5020d1d72d8c62841b13b Mon Sep 17 00:00:00 2001 From: James J Balamuta Date: Wed, 6 Mar 2024 14:22:30 -0800 Subject: [PATCH 1/7] Initial Dockerfile for codespaces... --- Dockerfiles/mlpack-codespace/Dockerfile | 49 +++++++++++++++++++++++++ 1 file changed, 49 insertions(+) create mode 100644 Dockerfiles/mlpack-codespace/Dockerfile diff --git a/Dockerfiles/mlpack-codespace/Dockerfile b/Dockerfiles/mlpack-codespace/Dockerfile new file mode 100644 index 0000000..21f15ec --- /dev/null +++ b/Dockerfiles/mlpack-codespace/Dockerfile @@ -0,0 +1,49 @@ +FROM mcr.microsoft.com/devcontainers/universal:focal + +LABEL maintainer="james.balamuta@gmail.com" + +## For apt to be noninteractive. +ENV DEBCONF_NONINTERACTIVE_SEEN true + +## Install baseline dependencies not found in the devcontainer +## For details on what's included, please see: +## https://github.com/devcontainers/images/tree/main/src/universal +RUN apt-get update -qq && apt-get install -y --no-install-recommends \ + binutils-dev \ + txt2man \ + doxygen \ + liblapack-dev \ + libblas-dev \ + libarpack2 \ + libsuperlu-dev \ + libstb-dev && \ + apt-get clean && rm -rf /var/lib/apt/lists/* && \ + pip3 --no-cache-dir install --upgrade --ignore-installed cython numpy \ + pandas setuptools + +## Install armadillo. +RUN curl -Lk https://files.mlpack.org/armadillo-11.4.1.tar.gz | tar -xvz && \ + cd armadillo* && \ + cmake . && \ + make && \ + sudo make install && \ + cd .. + +## Install ensmallen. +RUN wget http://ensmallen.org/files/ensmallen-2.19.0.tar.gz && \ + tar -xf ensmallen-2.19.0.tar.gz && \ + cd ensmallen-2.19.0 && \ + mkdir build && \ + cd build && \ + cmake ../ && \ + make install && \ + cd .. + +## Remove scripts now that we're done with them +RUN apt-get clean -y && rm -rf \ + armadillo* \ + ensmallen* + +# Setup environment. +ENV LD_LIBRARY_PATH /usr/local/lib +CMD /bin/bash From 5b3ce68bfc813df8c1c0e4e9949564a875fda1e1 Mon Sep 17 00:00:00 2001 From: James J Balamuta Date: Tue, 23 Jul 2024 15:00:18 -0700 Subject: [PATCH 2/7] Add libcereal-dev --- Dockerfiles/mlpack-codespace/Dockerfile | 1 + 1 file changed, 1 insertion(+) diff --git a/Dockerfiles/mlpack-codespace/Dockerfile b/Dockerfiles/mlpack-codespace/Dockerfile index 21f15ec..5b981cf 100644 --- a/Dockerfiles/mlpack-codespace/Dockerfile +++ b/Dockerfiles/mlpack-codespace/Dockerfile @@ -16,6 +16,7 @@ RUN apt-get update -qq && apt-get install -y --no-install-recommends \ libblas-dev \ libarpack2 \ libsuperlu-dev \ + libcereal-dev \ libstb-dev && \ apt-get clean && rm -rf /var/lib/apt/lists/* && \ pip3 --no-cache-dir install --upgrade --ignore-installed cython numpy \ From 34763afe79b3a6fb1296f011255c001d1ea391e3 Mon Sep 17 00:00:00 2001 From: James J Balamuta Date: Tue, 23 Jul 2024 15:00:46 -0700 Subject: [PATCH 3/7] Prevent macOS system files from being included in the input. --- .gitignore | 1 + 1 file changed, 1 insertion(+) create mode 100644 .gitignore diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..5509140 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +*.DS_Store From 1956db5a4a2400039260f21b6e5dad9892b24b7d Mon Sep 17 00:00:00 2001 From: James J Balamuta Date: Tue, 23 Jul 2024 15:17:36 -0700 Subject: [PATCH 4/7] Explore adding a step on R --- Dockerfiles/mlpack-codespace/Dockerfile | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/Dockerfiles/mlpack-codespace/Dockerfile b/Dockerfiles/mlpack-codespace/Dockerfile index 5b981cf..0573833 100644 --- a/Dockerfiles/mlpack-codespace/Dockerfile +++ b/Dockerfiles/mlpack-codespace/Dockerfile @@ -22,6 +22,12 @@ RUN apt-get update -qq && apt-get install -y --no-install-recommends \ pip3 --no-cache-dir install --upgrade --ignore-installed cython numpy \ pandas setuptools +# Add a run step for R and R packages. +RUN wget -qO- https://cloud.r-project.org/bin/linux/ubuntu/marutter_pubkey.asc | sudo tee -a /etc/apt/trusted.gpg.d/cran_ubuntu_key.asc \ + && add-apt-repository "deb https://cloud.r-project.org/bin/linux/ubuntu $(lsb_release -cs)-cran40/"\ + && apt -y install r-base r-base-dev \ + && apt -y install r-cran-languageserver r-cran-httpgd r-cran-rcpp r-cran-rcpparmadillo r-cran-rcppensmallen r-cran-devtools r-cran-testthat + ## Install armadillo. RUN curl -Lk https://files.mlpack.org/armadillo-11.4.1.tar.gz | tar -xvz && \ cd armadillo* && \ From 4447dfa4fd6295157e14faf8b14462a8f010890e Mon Sep 17 00:00:00 2001 From: James J Balamuta Date: Tue, 23 Jul 2024 16:21:59 -0700 Subject: [PATCH 5/7] Clean up the R install step Build R based on the official instructions Retrieve required packages for development through r2u --- Dockerfiles/mlpack-codespace/Dockerfile | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/Dockerfiles/mlpack-codespace/Dockerfile b/Dockerfiles/mlpack-codespace/Dockerfile index 0573833..d1bf4a0 100644 --- a/Dockerfiles/mlpack-codespace/Dockerfile +++ b/Dockerfiles/mlpack-codespace/Dockerfile @@ -23,10 +23,20 @@ RUN apt-get update -qq && apt-get install -y --no-install-recommends \ pandas setuptools # Add a run step for R and R packages. -RUN wget -qO- https://cloud.r-project.org/bin/linux/ubuntu/marutter_pubkey.asc | sudo tee -a /etc/apt/trusted.gpg.d/cran_ubuntu_key.asc \ - && add-apt-repository "deb https://cloud.r-project.org/bin/linux/ubuntu $(lsb_release -cs)-cran40/"\ +# Attempt tog et R packages from the cran40 repository. +# Note, this is tagged to the focal release! Change me. +RUN wget -qO- https://cloud.r-project.org/bin/linux/ubuntu/marutter_pubkey.asc | tee -a /etc/apt/trusted.gpg.d/cran_ubuntu_key.asc \ + && wget -q -O- https://eddelbuettel.github.io/r2u/assets/dirk_eddelbuettel_key.asc | tee -a /etc/apt/trusted.gpg.d/cranapt_key.asc \ + && add-apt-repository "deb https://cloud.r-project.org/bin/linux/ubuntu focal-cran40/"\ + && add-apt-repository "deb [arch=amd64] https://r2u.stat.illinois.edu/ubuntu focal main" \ + && echo "Package: *" > /etc/apt/preferences.d/99cranapt \ + && echo "Pin: release o=CRAN-Apt Project" >> /etc/apt/preferences.d/99cranapt \ + && echo "Pin: release l=CRAN-Apt Packages" >> /etc/apt/preferences.d/99cranapt \ + && echo "Pin-Priority: 700" >> /etc/apt/preferences.d/99cranapt \ + && apt update -qq \ && apt -y install r-base r-base-dev \ - && apt -y install r-cran-languageserver r-cran-httpgd r-cran-rcpp r-cran-rcpparmadillo r-cran-rcppensmallen r-cran-devtools r-cran-testthat + && apt -y install r-cran-rcpp r-cran-rcpparmadillo r-cran-devtools r-cran-testthat \ + && apt -y install r-cran-languageserver r-cran-httpgd r-cran-rcppensmallen ## Install armadillo. RUN curl -Lk https://files.mlpack.org/armadillo-11.4.1.tar.gz | tar -xvz && \ From 2129eb6e41bf14ca8ef2e55901803a535501d4f3 Mon Sep 17 00:00:00 2001 From: James J Balamuta Date: Tue, 23 Jul 2024 16:22:53 -0700 Subject: [PATCH 6/7] Handle docker linting warnings: 1. LegacyKeyValueFormat: "ENV key=value" should be used instead of legacy "ENV key value" format (line 6, 68) And 2. JSONArgsRecommended: JSON arguments recommended for CMD to prevent unintended behavior related to OS signals (line 69) --- Dockerfiles/mlpack-codespace/Dockerfile | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Dockerfiles/mlpack-codespace/Dockerfile b/Dockerfiles/mlpack-codespace/Dockerfile index d1bf4a0..5175936 100644 --- a/Dockerfiles/mlpack-codespace/Dockerfile +++ b/Dockerfiles/mlpack-codespace/Dockerfile @@ -3,7 +3,7 @@ FROM mcr.microsoft.com/devcontainers/universal:focal LABEL maintainer="james.balamuta@gmail.com" ## For apt to be noninteractive. -ENV DEBCONF_NONINTERACTIVE_SEEN true +ENV DEBCONF_NONINTERACTIVE_SEEN=true ## Install baseline dependencies not found in the devcontainer ## For details on what's included, please see: @@ -62,5 +62,5 @@ RUN apt-get clean -y && rm -rf \ ensmallen* # Setup environment. -ENV LD_LIBRARY_PATH /usr/local/lib -CMD /bin/bash +ENV LD_LIBRARY_PATH=/usr/local/lib +CMD ["/bin/bash"] From f6c18d12e17840b3a8b8c185123f08b055bd0fea Mon Sep 17 00:00:00 2001 From: James J Balamuta Date: Thu, 25 Jul 2024 12:09:21 -0700 Subject: [PATCH 7/7] Switch to minimum version of armadillo supported --- Dockerfiles/mlpack-codespace/Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfiles/mlpack-codespace/Dockerfile b/Dockerfiles/mlpack-codespace/Dockerfile index 5175936..e7ee807 100644 --- a/Dockerfiles/mlpack-codespace/Dockerfile +++ b/Dockerfiles/mlpack-codespace/Dockerfile @@ -39,7 +39,7 @@ RUN wget -qO- https://cloud.r-project.org/bin/linux/ubuntu/marutter_pubkey.asc | && apt -y install r-cran-languageserver r-cran-httpgd r-cran-rcppensmallen ## Install armadillo. -RUN curl -Lk https://files.mlpack.org/armadillo-11.4.1.tar.gz | tar -xvz && \ +RUN curl -Lk https://files.mlpack.org/armadillo-10.8.2.tar.gz | tar -xvz && \ cd armadillo* && \ cmake . && \ make && \