From 52fc8139a125619d64e4a635ec22a1b24587b084 Mon Sep 17 00:00:00 2001 From: "David J. Malan" Date: Fri, 26 Jan 2024 00:33:11 -0500 Subject: [PATCH 01/15] added R --- Dockerfile | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) diff --git a/Dockerfile b/Dockerfile index ae2d949..e657f1b 100644 --- a/Dockerfile +++ b/Dockerfile @@ -31,6 +31,18 @@ RUN cd /tmp && \ pip3 install --no-cache-dir --upgrade pip +# Install R +# https://cran.rstudio.com/bin/linux/ubuntu/ +RUN apt update && \ + apt install --no-install-recommends --yes \ + dirmngr \ + software-properties-common \ && + 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 --yes "deb https://cloud.r-project.org/bin/linux/ubuntu $(lsb_release -cs)-cran40/" && \ + apt install --no-install-recommends --no-install-suggests --yes r-base + # add-apt-repository --yes ppa:c2d4u.team/c2d4u4.0+ + + # Install Ruby 3.2.x # https://www.ruby-lang.org/en/downloads/ RUN apt update && \ @@ -106,6 +118,29 @@ RUN curl -fsSL https://cli.github.com/packages/githubcli-archive-keyring.gpg | d apt install gh --no-install-recommends --no-install-suggests --yes +# Install RStudio +# https://posit.co/download/rstudio-server/ +# https://github.com/rstudio/rstudio/tags +# https://cran.rstudio.com/bin/linux/ubuntu/ +RUN apt update && \ + apt install --no-install-recommends --yes \ + cmake \ + lsb-release && \ + cd /tmp && \ + wget https://github.com/rstudio/rstudio/archive/refs/tags/v2023.12.0+369.tar.gz && \ + tar xzf v2023.12.0+369.tar.gz && \ + cd rstudio-2023.12.0-369/dependencies/linux && \ + ./install-dependencies-jammy && \ + cd ../.. && \ + mkdir build && \ + cd build && \ + cmake .. -DCMAKE_INSTALL_PREFIX=/opt/rstudio -DCMAKE_BUILD_TYPE=RelMinSize -DRSTUDIO_TARGET=Server && \ + make install && \ + add-apt-repository --yes ppa:c2d4u.team/c2d4u4.0+ && \ + apt update && \ + apt install --no-install-recommends --yes r-cran-tidyverse + + # Final stage FROM ubuntu:22.04 LABEL maintainer="sysadmins@cs50.harvard.edu" From fceacf299f868b3b736eddb47da56c71d7e00280 Mon Sep 17 00:00:00 2001 From: "David J. Malan" Date: Fri, 26 Jan 2024 01:13:16 -0500 Subject: [PATCH 02/15] updated R install --- Dockerfile | 49 +++++++++++++++++-------------------------------- 1 file changed, 17 insertions(+), 32 deletions(-) diff --git a/Dockerfile b/Dockerfile index e657f1b..fe04e3d 100644 --- a/Dockerfile +++ b/Dockerfile @@ -32,15 +32,23 @@ RUN cd /tmp && \ # Install R -# https://cran.rstudio.com/bin/linux/ubuntu/ -RUN apt update && \ - apt install --no-install-recommends --yes \ - dirmngr \ - software-properties-common \ && - 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 --yes "deb https://cloud.r-project.org/bin/linux/ubuntu $(lsb_release -cs)-cran40/" && \ - apt install --no-install-recommends --no-install-suggests --yes r-base - # add-apt-repository --yes ppa:c2d4u.team/c2d4u4.0+ +# https://docs.posit.co/resources/install-r-source/ +# https://cran.rstudio.com/src/base/R-4/ +RUN sed -i "/^#.*deb-src.*universe$/s/^# //g" /etc/apt/sources.list && \ + apt update && \ + apt build-dep --yes r-base && \ + cd /tmp && \ + wget https://cran.rstudio.com/src/base/R-4/R-4.3.2.tar.gz && \ + tar xzf R-4.3.2.tar.gz && \ + rm -f R-4.3.2.tar.gz && \ + cd R-4.3.2 && \ + ./configure --prefix=/opt/R --enable-memory-profiling --enable-R-shlib --with-blas --with-lapack && \ + make && \ + make install && \ + ln --symbolic /opt/R/bin/* /opt/bin/ && \ + chmod a+rx /opt/bin/* && \ + add-apt-repository --yes ppa:c2d4u.team/c2d4u4.0+ && \ + apt update # Install Ruby 3.2.x @@ -118,29 +126,6 @@ RUN curl -fsSL https://cli.github.com/packages/githubcli-archive-keyring.gpg | d apt install gh --no-install-recommends --no-install-suggests --yes -# Install RStudio -# https://posit.co/download/rstudio-server/ -# https://github.com/rstudio/rstudio/tags -# https://cran.rstudio.com/bin/linux/ubuntu/ -RUN apt update && \ - apt install --no-install-recommends --yes \ - cmake \ - lsb-release && \ - cd /tmp && \ - wget https://github.com/rstudio/rstudio/archive/refs/tags/v2023.12.0+369.tar.gz && \ - tar xzf v2023.12.0+369.tar.gz && \ - cd rstudio-2023.12.0-369/dependencies/linux && \ - ./install-dependencies-jammy && \ - cd ../.. && \ - mkdir build && \ - cd build && \ - cmake .. -DCMAKE_INSTALL_PREFIX=/opt/rstudio -DCMAKE_BUILD_TYPE=RelMinSize -DRSTUDIO_TARGET=Server && \ - make install && \ - add-apt-repository --yes ppa:c2d4u.team/c2d4u4.0+ && \ - apt update && \ - apt install --no-install-recommends --yes r-cran-tidyverse - - # Final stage FROM ubuntu:22.04 LABEL maintainer="sysadmins@cs50.harvard.edu" From 3ebda3571a0dc02b51c3f3af9f4612af68d8d088 Mon Sep 17 00:00:00 2001 From: "David J. Malan" Date: Fri, 26 Jan 2024 01:30:41 -0500 Subject: [PATCH 03/15] removed --prefix for R --- Dockerfile | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/Dockerfile b/Dockerfile index fe04e3d..406e076 100644 --- a/Dockerfile +++ b/Dockerfile @@ -42,11 +42,9 @@ RUN sed -i "/^#.*deb-src.*universe$/s/^# //g" /etc/apt/sources.list && \ tar xzf R-4.3.2.tar.gz && \ rm -f R-4.3.2.tar.gz && \ cd R-4.3.2 && \ - ./configure --prefix=/opt/R --enable-memory-profiling --enable-R-shlib --with-blas --with-lapack && \ + ./configure --enable-memory-profiling --enable-R-shlib --with-blas --with-lapack && \ make && \ make install && \ - ln --symbolic /opt/R/bin/* /opt/bin/ && \ - chmod a+rx /opt/bin/* && \ add-apt-repository --yes ppa:c2d4u.team/c2d4u4.0+ && \ apt update From c91eab64249b9ea49ebf51db8b9b0bc912c0a1bd Mon Sep 17 00:00:00 2001 From: "David J. Malan" Date: Fri, 26 Jan 2024 01:49:46 -0500 Subject: [PATCH 04/15] using long opts --- Dockerfile | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/Dockerfile b/Dockerfile index 406e076..2c75dc1 100644 --- a/Dockerfile +++ b/Dockerfile @@ -34,19 +34,19 @@ RUN cd /tmp && \ # Install R # https://docs.posit.co/resources/install-r-source/ # https://cran.rstudio.com/src/base/R-4/ -RUN sed -i "/^#.*deb-src.*universe$/s/^# //g" /etc/apt/sources.list && \ +RUN sed --in-place "/^#.*deb-src.*universe$/s/^# //g" /etc/apt/sources.list && \ apt update && \ apt build-dep --yes r-base && \ cd /tmp && \ wget https://cran.rstudio.com/src/base/R-4/R-4.3.2.tar.gz && \ tar xzf R-4.3.2.tar.gz && \ - rm -f R-4.3.2.tar.gz && \ + rm --force R-4.3.2.tar.gz && \ cd R-4.3.2 && \ ./configure --enable-memory-profiling --enable-R-shlib --with-blas --with-lapack && \ make && \ make install && \ - add-apt-repository --yes ppa:c2d4u.team/c2d4u4.0+ && \ - apt update + cd .. && \ + rm --force --recursive R-4.3.2 # Install Ruby 3.2.x @@ -56,7 +56,7 @@ RUN apt update && \ autoconf \ libyaml-dev && \ apt clean && \ - rm -rf /var/lib/apt/lists/* && \ + rm --force --recursive /var/lib/apt/lists/* && \ cd /tmp && \ curl https://cache.ruby-lang.org/pub/ruby/3.2/ruby-3.2.2.tar.gz --output ruby-3.2.2.tar.gz && \ tar xzf ruby-3.2.2.tar.gz && \ From a165985de03cb7dc15e6fb5f190b5aa987df6a45 Mon Sep 17 00:00:00 2001 From: "David J. Malan" Date: Fri, 26 Jan 2024 01:58:08 -0500 Subject: [PATCH 05/15] added back prefix --- Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index 2c75dc1..c0bffe8 100644 --- a/Dockerfile +++ b/Dockerfile @@ -42,7 +42,7 @@ RUN sed --in-place "/^#.*deb-src.*universe$/s/^# //g" /etc/apt/sources.list && \ tar xzf R-4.3.2.tar.gz && \ rm --force R-4.3.2.tar.gz && \ cd R-4.3.2 && \ - ./configure --enable-memory-profiling --enable-R-shlib --with-blas --with-lapack && \ + ./configure --enable-memory-profiling --enable-R-shlib --prefix=/usr/local --with-blas --with-lapack && \ make && \ make install && \ cd .. && \ From 658e6224d255cef8ded954b197a06e50636ed40b Mon Sep 17 00:00:00 2001 From: "David J. Malan" Date: Fri, 26 Jan 2024 02:02:58 -0500 Subject: [PATCH 06/15] added TODO --- Dockerfile | 1 + 1 file changed, 1 insertion(+) diff --git a/Dockerfile b/Dockerfile index c0bffe8..dd3b121 100644 --- a/Dockerfile +++ b/Dockerfile @@ -36,6 +36,7 @@ RUN cd /tmp && \ # https://cran.rstudio.com/src/base/R-4/ RUN sed --in-place "/^#.*deb-src.*universe$/s/^# //g" /etc/apt/sources.list && \ apt update && \ + #apt install --yes libblas3 && `# TODO: necessary even with prefix?` \ apt build-dep --yes r-base && \ cd /tmp && \ wget https://cran.rstudio.com/src/base/R-4/R-4.3.2.tar.gz && \ From 1f4fd1b954ebba7dd412a46f322c046cd99201fe Mon Sep 17 00:00:00 2001 From: "David J. Malan" Date: Fri, 26 Jan 2024 11:09:52 -0500 Subject: [PATCH 07/15] tweaked R install --- Dockerfile | 72 +++++++++++++++++++++++++++--------------------------- 1 file changed, 36 insertions(+), 36 deletions(-) diff --git a/Dockerfile b/Dockerfile index dd3b121..1dd74a7 100644 --- a/Dockerfile +++ b/Dockerfile @@ -13,6 +13,38 @@ RUN apt update && \ make tk-dev unzip wget xz-utils zlib1g-dev +# Install Java 21.x +# http://jdk.java.net/21/ +RUN cd /tmp && \ + curl --remote-name https://download.java.net/java/GA/jdk21.0.1/415e3f918a1f4062a0074a2794853d0d/12/GPL/openjdk-21.0.1_linux-x64_bin.tar.gz && \ + tar xzf openjdk-21.0.1_linux-x64_bin.tar.gz && \ + rm --force openjdk-21.0.1_linux-x64_bin.tar.gz && \ + mv jdk-21.0.1 /opt/ && \ + mkdir --parent /opt/bin && \ + ln --symbolic /opt/jdk-21.0.1/bin/* /opt/bin/ && \ + chmod a+rx /opt/bin/* + + +# Install Node.js 21.x +# https://nodejs.dev/en/download/ +# https://github.com/tj/n#installation +RUN curl --location https://raw.githubusercontent.com/tj/n/master/bin/n --output /usr/local/bin/n && \ + chmod a+x /usr/local/bin/n && \ + n 21.6.1 + + +# Install Node.js packages +RUN npm install --global \ + http-server + + +# Patch index.js in http-server +COPY index.js.patch /tmp +RUN cd /usr/local/lib/node_modules/http-server/lib/core/show-dir && \ + patch index.js < /tmp/index.js.patch && \ + rm --force /tmp/index.js.patch + + # Install Python 3.11.x # https://www.python.org/downloads/ RUN cd /tmp && \ @@ -32,18 +64,17 @@ RUN cd /tmp && \ # Install R -# https://docs.posit.co/resources/install-r-source/ +# https://docs.posit.co/resources/install-r-source/#build-and-install-r # https://cran.rstudio.com/src/base/R-4/ RUN sed --in-place "/^#.*deb-src.*universe$/s/^# //g" /etc/apt/sources.list && \ apt update && \ - #apt install --yes libblas3 && `# TODO: necessary even with prefix?` \ apt build-dep --yes r-base && \ cd /tmp && \ wget https://cran.rstudio.com/src/base/R-4/R-4.3.2.tar.gz && \ tar xzf R-4.3.2.tar.gz && \ rm --force R-4.3.2.tar.gz && \ cd R-4.3.2 && \ - ./configure --enable-memory-profiling --enable-R-shlib --prefix=/usr/local --with-blas --with-lapack && \ + ./configure --enable-memory-profiling --enable-R-shlib && \ make && \ make install && \ cd .. && \ @@ -96,26 +127,6 @@ RUN cd /tmp && \ rm --force /tmp/shell.c.patch -# Install Java 21.x -# http://jdk.java.net/21/ -RUN cd /tmp && \ - curl --remote-name https://download.java.net/java/GA/jdk21.0.1/415e3f918a1f4062a0074a2794853d0d/12/GPL/openjdk-21.0.1_linux-x64_bin.tar.gz && \ - tar xzf openjdk-21.0.1_linux-x64_bin.tar.gz && \ - rm --force openjdk-21.0.1_linux-x64_bin.tar.gz && \ - mv jdk-21.0.1 /opt/ && \ - mkdir --parent /opt/bin && \ - ln --symbolic /opt/jdk-21.0.1/bin/* /opt/bin/ && \ - chmod a+rx /opt/bin/* - - -# Install Node.js 21.x -# https://nodejs.dev/en/download/ -# https://github.com/tj/n#installation -RUN curl --location https://raw.githubusercontent.com/tj/n/master/bin/n --output /usr/local/bin/n && \ - chmod a+x /usr/local/bin/n && \ - n 21.2.0 - - # Install GitHub CLI # https://github.com/cli/cli/blob/trunk/docs/install_linux.md#debian-ubuntu-linux-raspberry-pi-os-apt RUN curl -fsSL https://cli.github.com/packages/githubcli-archive-keyring.gpg | dd of=/usr/share/keyrings/githubcli-archive-keyring.gpg && \ @@ -132,8 +143,9 @@ ARG DEBIAN_FRONTEND=noninteractive # Copy files from builder -COPY --from=builder /usr /usr +COPY --from=builder /etc /etc COPY --from=builder /opt /opt +COPY --from=builder /usr/local /usr/local # Avoid "delaying package configuration, since apt-utils is not installed" @@ -215,18 +227,6 @@ RUN curl https://packagecloud.io/install/repositories/cs50/repo/script.deb.sh | "submit50<4" -# Install Node.js packages -RUN npm install --global \ - http-server - - -# Patch index.js in http-server -COPY index.js.patch /tmp -RUN cd /usr/local/lib/node_modules/http-server/lib/core/show-dir && \ - patch index.js < /tmp/index.js.patch && \ - rm --force /tmp/index.js.patch - - # Copy files to image COPY ./etc /etc COPY ./opt /opt From f6659a49285a57a25f735f317304e8ff18e156b4 Mon Sep 17 00:00:00 2001 From: "David J. Malan" Date: Fri, 26 Jan 2024 11:13:03 -0500 Subject: [PATCH 08/15] removed patch --- http-server.patch | 5 ----- 1 file changed, 5 deletions(-) delete mode 100644 http-server.patch diff --git a/http-server.patch b/http-server.patch deleted file mode 100644 index c9bb98c..0000000 --- a/http-server.patch +++ /dev/null @@ -1,5 +0,0 @@ -# diff /usr/local/lib/node_modules/http-server/bin/http-server http-server > http-server.patch -208c208 -< logger.info([chalk.yellow('\nhttp-server version: '), chalk.cyan(require('../package.json').version)].join('')); ---- -> //logger.info([chalk.yellow('\nhttp-server version: '), chalk.cyan(require('../package.json').version)].join('')); From df2f9815f92621cd5a2467fc56163e41407a3d72 Mon Sep 17 00:00:00 2001 From: "David J. Malan" Date: Fri, 26 Jan 2024 11:36:06 -0500 Subject: [PATCH 09/15] updated SQLite --- Dockerfile | 10 +++++----- shell.c.patch | 9 ++------- 2 files changed, 7 insertions(+), 12 deletions(-) diff --git a/Dockerfile b/Dockerfile index 1dd74a7..cde70e5 100644 --- a/Dockerfile +++ b/Dockerfile @@ -116,14 +116,14 @@ RUN gem install --no-document \ # https://www.sqlite.org/howtocompile.html#compiling_the_command_line_interface COPY shell.c.patch /tmp RUN cd /tmp && \ - curl --remote-name https://www.sqlite.org/2023/sqlite-amalgamation-3440000.zip && \ - unzip sqlite-amalgamation-3440000.zip && \ - rm --force sqlite-amalgamation-3440000.zip && \ - cd sqlite-amalgamation-3440000 && \ + curl --remote-name https://www.sqlite.org/2024/sqlite-amalgamation-3450000.zip && \ + unzip sqlite-amalgamation-3450000.zip && \ + rm --force sqlite-amalgamation-3450000.zip && \ + cd sqlite-amalgamation-3450000 && \ patch shell.c < /tmp/shell.c.patch && \ gcc -D HAVE_READLINE -D SQLITE_DEFAULT_FOREIGN_KEYS=1 -D SQLITE_OMIT_DYNAPROMPT=1 shell.c sqlite3.c -lpthread -ldl -lm -lreadline -lncurses -o /usr/local/bin/sqlite3 && \ cd .. && \ - rm --force --recursive sqlite-amalgamation-3440000 && \ + rm --force --recursive sqlite-amalgamation-3450000 && \ rm --force /tmp/shell.c.patch diff --git a/shell.c.patch b/shell.c.patch index 0c22fbe..35b0a32 100644 --- a/shell.c.patch +++ b/shell.c.patch @@ -1,9 +1,4 @@ -# diff shell.c shell_modified.c > shell.c.patch -29321,29323c29321,29323 -< oputf("SQLite version %s %.19s%s\n" /*extra-version-info*/ +29438,29440d29437 +< sputf(stdout, "SQLite version %s %.19s%s\n" /*extra-version-info*/ < "Enter \".help\" for usage hints.\n", < sqlite3_libversion(), sqlite3_sourceid(), SHELL_CIO_CHAR_SET); ---- -> //oputf("SQLite version %s %.19s%s\n" /*extra-version-info*/ -> // "Enter \".help\" for usage hints.\n", -> // sqlite3_libversion(), sqlite3_sourceid(), SHELL_CIO_CHAR_SET); From 8c48dbba33079cadde37f64a711adf2b20a20d65 Mon Sep 17 00:00:00 2001 From: "David J. Malan" Date: Fri, 26 Jan 2024 13:30:26 -0500 Subject: [PATCH 10/15] added --vanilla --- etc/profile.d/cli.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/etc/profile.d/cli.sh b/etc/profile.d/cli.sh index 971de08..be2df04 100644 --- a/etc/profile.d/cli.sh +++ b/etc/profile.d/cli.sh @@ -25,6 +25,7 @@ if [ "$(whoami)" != "root" ]; then alias mv="mv -i" alias pip="pip --no-cache-dir" alias python="python -q" + alias r="r --vanilla" alias rm="rm -i" alias sudo="sudo " # Trailing space enables elevated command to be an alias From e28fea67a50c045affa1c7c5613f31dc223ab1f6 Mon Sep 17 00:00:00 2001 From: "David J. Malan" Date: Fri, 26 Jan 2024 18:43:49 -0500 Subject: [PATCH 11/15] fixed stats package --- Dockerfile | 24 +++++++++++++----------- etc/profile.d/cli.sh | 2 +- 2 files changed, 14 insertions(+), 12 deletions(-) diff --git a/Dockerfile b/Dockerfile index cde70e5..74bb796 100644 --- a/Dockerfile +++ b/Dockerfile @@ -74,7 +74,7 @@ RUN sed --in-place "/^#.*deb-src.*universe$/s/^# //g" /etc/apt/sources.list && \ tar xzf R-4.3.2.tar.gz && \ rm --force R-4.3.2.tar.gz && \ cd R-4.3.2 && \ - ./configure --enable-memory-profiling --enable-R-shlib && \ + ./configure --enable-memory-profiling --enable-R-shlib --with-blas --with-lapack && \ make && \ make install && \ cd .. && \ @@ -127,15 +127,6 @@ RUN cd /tmp && \ rm --force /tmp/shell.c.patch -# Install GitHub CLI -# https://github.com/cli/cli/blob/trunk/docs/install_linux.md#debian-ubuntu-linux-raspberry-pi-os-apt -RUN curl -fsSL https://cli.github.com/packages/githubcli-archive-keyring.gpg | dd of=/usr/share/keyrings/githubcli-archive-keyring.gpg && \ - chmod go+r /usr/share/keyrings/githubcli-archive-keyring.gpg && \ - echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/githubcli-archive-keyring.gpg] https://cli.github.com/packages stable main" | tee /etc/apt/sources.list.d/github-cli.list > /dev/null && \ - apt update && \ - apt install gh --no-install-recommends --no-install-suggests --yes - - # Final stage FROM ubuntu:22.04 LABEL maintainer="sysadmins@cs50.harvard.edu" @@ -143,7 +134,7 @@ ARG DEBIAN_FRONTEND=noninteractive # Copy files from builder -COPY --from=builder /etc /etc +#COPY --from=builder /etc /etc COPY --from=builder /opt /opt COPY --from=builder /usr/local /usr/local @@ -194,7 +185,9 @@ RUN curl https://packagecloud.io/install/repositories/cs50/repo/script.deb.sh | git-lfs \ jq \ less \ + libblas3 `# For R` \ libcs50 \ + liblapack3 `# For R` \ libmagic-dev `# For style50` \ libpango-1.0-0 libharfbuzz0b libpangoft2-1.0-0 `# For render50` \ libyaml-0-2 `# Runtime package for gem` \ @@ -227,6 +220,15 @@ RUN curl https://packagecloud.io/install/repositories/cs50/repo/script.deb.sh | "submit50<4" +# Install GitHub CLI (after builder stage, because writes to /usr/share) +# https://github.com/cli/cli/blob/trunk/docs/install_linux.md#debian-ubuntu-linux-raspberry-pi-os-apt +RUN curl -fsSL https://cli.github.com/packages/githubcli-archive-keyring.gpg | dd of=/usr/share/keyrings/githubcli-archive-keyring.gpg && \ + chmod go+r /usr/share/keyrings/githubcli-archive-keyring.gpg && \ + echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/githubcli-archive-keyring.gpg] https://cli.github.com/packages stable main" | tee /etc/apt/sources.list.d/github-cli.list > /dev/null && \ + apt update && \ + apt install gh --no-install-recommends --no-install-suggests --yes + + # Copy files to image COPY ./etc /etc COPY ./opt /opt diff --git a/etc/profile.d/cli.sh b/etc/profile.d/cli.sh index be2df04..66dbba7 100644 --- a/etc/profile.d/cli.sh +++ b/etc/profile.d/cli.sh @@ -25,7 +25,7 @@ if [ "$(whoami)" != "root" ]; then alias mv="mv -i" alias pip="pip --no-cache-dir" alias python="python -q" - alias r="r --vanilla" + alias R="R --vanilla" alias rm="rm -i" alias sudo="sudo " # Trailing space enables elevated command to be an alias From 3cab982edb1c1a64d1431987cca37c6f921b60e4 Mon Sep 17 00:00:00 2001 From: "David J. Malan" Date: Fri, 26 Jan 2024 20:04:45 -0500 Subject: [PATCH 12/15] tidied Dockerfile --- Dockerfile | 23 +++++++++++++++-------- 1 file changed, 15 insertions(+), 8 deletions(-) diff --git a/Dockerfile b/Dockerfile index 74bb796..2bccdc2 100644 --- a/Dockerfile +++ b/Dockerfile @@ -3,14 +3,12 @@ FROM ubuntu:22.04 as builder ARG DEBIAN_FRONTEND=noninteractive -# Suggested build environment for Python, per pyenv, even though we're building ourselves -# https://github.com/pyenv/pyenv/wiki#suggested-build-environment +# Install cURL RUN apt update && \ apt install --no-install-recommends --no-install-suggests --yes \ - curl ca-certificates build-essential git \ - libssl-dev libbz2-dev libreadline-dev libsqlite3-dev \ - llvm libncursesw5-dev libxml2-dev libxmlsec1-dev libffi-dev liblzma-dev \ - make tk-dev unzip wget xz-utils zlib1g-dev + ca-certificates \ + curl \ + patch # Install Java 21.x @@ -45,6 +43,16 @@ RUN cd /usr/local/lib/node_modules/http-server/lib/core/show-dir && \ rm --force /tmp/index.js.patch +# Suggested build environment for Python, per pyenv, even though we're building ourselves +# https://github.com/pyenv/pyenv/wiki#suggested-build-environment +RUN apt update && \ + apt install --no-install-recommends --no-install-suggests --yes \ + build-essential ca-certificates curl git \ + libssl-dev libbz2-dev libreadline-dev libsqlite3-dev \ + llvm libncursesw5-dev libxml2-dev libxmlsec1-dev libffi-dev liblzma-dev \ + make tk-dev unzip wget xz-utils zlib1g-dev + + # Install Python 3.11.x # https://www.python.org/downloads/ RUN cd /tmp && \ @@ -74,7 +82,7 @@ RUN sed --in-place "/^#.*deb-src.*universe$/s/^# //g" /etc/apt/sources.list && \ tar xzf R-4.3.2.tar.gz && \ rm --force R-4.3.2.tar.gz && \ cd R-4.3.2 && \ - ./configure --enable-memory-profiling --enable-R-shlib --with-blas --with-lapack && \ + ./configure --enable-memory-profiling --enable-R-shlib && \ make && \ make install && \ cd .. && \ @@ -185,7 +193,6 @@ RUN curl https://packagecloud.io/install/repositories/cs50/repo/script.deb.sh | git-lfs \ jq \ less \ - libblas3 `# For R` \ libcs50 \ liblapack3 `# For R` \ libmagic-dev `# For style50` \ From 5a6e240cfb30436f07189b47e48151c5a69b28aa Mon Sep 17 00:00:00 2001 From: "David J. Malan" Date: Fri, 26 Jan 2024 20:19:41 -0500 Subject: [PATCH 13/15] downloading JDK conditionally --- Dockerfile | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/Dockerfile b/Dockerfile index 2bccdc2..07db4a1 100644 --- a/Dockerfile +++ b/Dockerfile @@ -5,6 +5,7 @@ ARG DEBIAN_FRONTEND=noninteractive # Install cURL RUN apt update && \ + apt upgrade --yes && \ apt install --no-install-recommends --no-install-suggests --yes \ ca-certificates \ curl \ @@ -14,12 +15,13 @@ RUN apt update && \ # Install Java 21.x # http://jdk.java.net/21/ RUN cd /tmp && \ - curl --remote-name https://download.java.net/java/GA/jdk21.0.1/415e3f918a1f4062a0074a2794853d0d/12/GPL/openjdk-21.0.1_linux-x64_bin.tar.gz && \ - tar xzf openjdk-21.0.1_linux-x64_bin.tar.gz && \ - rm --force openjdk-21.0.1_linux-x64_bin.tar.gz && \ - mv jdk-21.0.1 /opt/ && \ + if [ $(uname -m) = "x86_64" ]; then ARCH="x64"; else ARCH="aarch64"; fi && \ + curl --remote-name https://download.java.net/java/GA/jdk21.0.2/f2283984656d49d69e91c558476027ac/13/GPL/openjdk-21.0.2_linux-${ARCH}_bin.tar.gz && \ + tar xzf openjdk-21.0.2_linux-${ARCH}_bin.tar.gz && \ + rm --force openjdk-21.0.2_linux-${ARCH}_bin.tar.gz && \ + mv jdk-21.0.2 /opt/jdk && \ mkdir --parent /opt/bin && \ - ln --symbolic /opt/jdk-21.0.1/bin/* /opt/bin/ && \ + ln --symbolic /opt/jdk/bin/* /opt/bin/ && \ chmod a+rx /opt/bin/* From 6558ed369ad57ab80a52829210cd6aff717c5984 Mon Sep 17 00:00:00 2001 From: "David J. Malan" Date: Fri, 26 Jan 2024 21:08:56 -0500 Subject: [PATCH 14/15] tidied Dockerfile --- Dockerfile | 42 ++++++++++++++++++++++++------------------ 1 file changed, 24 insertions(+), 18 deletions(-) diff --git a/Dockerfile b/Dockerfile index 07db4a1..773147a 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,15 +1,14 @@ -# Build statge +# Build stage FROM ubuntu:22.04 as builder ARG DEBIAN_FRONTEND=noninteractive -# Install cURL +# Stage-wide dependencies RUN apt update && \ - apt upgrade --yes && \ apt install --no-install-recommends --no-install-suggests --yes \ + build-essential \ ca-certificates \ - curl \ - patch + curl # Install Java 21.x @@ -58,7 +57,7 @@ RUN apt update && \ # Install Python 3.11.x # https://www.python.org/downloads/ RUN cd /tmp && \ - curl https://www.python.org/ftp/python/3.11.7/Python-3.11.7.tgz --output Python-3.11.7.tgz && \ + curl --remote-name https://www.python.org/ftp/python/3.11.7/Python-3.11.7.tgz && \ tar xzf Python-3.11.7.tgz && \ rm --force Python-3.11.7.tgz && \ cd Python-3.11.7 && \ @@ -80,7 +79,7 @@ RUN sed --in-place "/^#.*deb-src.*universe$/s/^# //g" /etc/apt/sources.list && \ apt update && \ apt build-dep --yes r-base && \ cd /tmp && \ - wget https://cran.rstudio.com/src/base/R-4/R-4.3.2.tar.gz && \ + curl --remote-name https://cran.rstudio.com/src/base/R-4/R-4.3.2.tar.gz && \ tar xzf R-4.3.2.tar.gz && \ rm --force R-4.3.2.tar.gz && \ cd R-4.3.2 && \ @@ -144,7 +143,6 @@ ARG DEBIAN_FRONTEND=noninteractive # Copy files from builder -#COPY --from=builder /etc /etc COPY --from=builder /opt /opt COPY --from=builder /usr/local /usr/local @@ -154,8 +152,6 @@ COPY --from=builder /usr/local /usr/local RUN apt update && \ apt install --no-install-recommends --no-install-suggests --yes \ apt-utils \ - curl \ - ca-certificates \ locales && \ locale-gen \ en_US.utf8 \ @@ -177,16 +173,18 @@ RUN apt update && \ ENV LANG=C.UTF-8 -# Install CS50, Ubuntu, and Python packages -RUN curl https://packagecloud.io/install/repositories/cs50/repo/script.deb.sh | bash && \ - apt update && \ +# Install Ubuntu packages +RUN apt update && \ + apt upgrade --yes && \ apt install --no-install-recommends --no-install-suggests --yes \ astyle \ bash-completion \ build-essential `# dpkg-dev, libc, gcc, g++, make, etc.`\ + ca-certificates \ clang \ coreutils `# For fold` \ cowsay \ + curl \ dos2unix \ dnsutils `# For nslookup` \ fonts-noto-color-emoji `# For render50` \ @@ -195,7 +193,6 @@ RUN curl https://packagecloud.io/install/repositories/cs50/repo/script.deb.sh | git-lfs \ jq \ less \ - libcs50 \ liblapack3 `# For R` \ libmagic-dev `# For style50` \ libpango-1.0-0 libharfbuzz0b libpangoft2-1.0-0 `# For render50` \ @@ -212,8 +209,17 @@ RUN curl https://packagecloud.io/install/repositories/cs50/repo/script.deb.sh | valgrind \ vim \ zip && \ - apt clean && \ - pip3 install --no-cache-dir \ + apt clean + + +# Install CS50 library +RUN curl https://packagecloud.io/install/repositories/cs50/repo/script.deb.sh | bash && \ + apt update && \ + apt install --yes libcs50 + + +# Install Python packages +RUN pip3 install --no-cache-dir \ autopep8 \ black \ "check50<4" \ @@ -231,11 +237,11 @@ RUN curl https://packagecloud.io/install/repositories/cs50/repo/script.deb.sh | # Install GitHub CLI (after builder stage, because writes to /usr/share) # https://github.com/cli/cli/blob/trunk/docs/install_linux.md#debian-ubuntu-linux-raspberry-pi-os-apt -RUN curl -fsSL https://cli.github.com/packages/githubcli-archive-keyring.gpg | dd of=/usr/share/keyrings/githubcli-archive-keyring.gpg && \ +RUN curl --fail --location --show-error --silent https://cli.github.com/packages/githubcli-archive-keyring.gpg | dd of=/usr/share/keyrings/githubcli-archive-keyring.gpg && \ chmod go+r /usr/share/keyrings/githubcli-archive-keyring.gpg && \ echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/githubcli-archive-keyring.gpg] https://cli.github.com/packages stable main" | tee /etc/apt/sources.list.d/github-cli.list > /dev/null && \ apt update && \ - apt install gh --no-install-recommends --no-install-suggests --yes + apt install --no-install-recommends --no-install-suggests --yes gh # Copy files to image From 67023271b515107b36bd4ccf78fa174ea99d2c9e Mon Sep 17 00:00:00 2001 From: "David J. Malan" Date: Fri, 26 Jan 2024 23:00:13 -0500 Subject: [PATCH 15/15] added wget --- Dockerfile | 1 + 1 file changed, 1 insertion(+) diff --git a/Dockerfile b/Dockerfile index 773147a..9027949 100644 --- a/Dockerfile +++ b/Dockerfile @@ -208,6 +208,7 @@ RUN apt update && \ unzip \ valgrind \ vim \ + wget \ zip && \ apt clean