From e2b7a561c3947693fdf38a5aa9e65d308c2e31f4 Mon Sep 17 00:00:00 2001 From: Patrizio Bertoni Date: Tue, 3 Mar 2026 21:53:42 +0100 Subject: [PATCH 1/2] Fixing Dockerfile logic to avoid root access. Added also an utility build script --- Dockerfile | 16 ++++++++-------- build.sh | 10 ++++++++++ 2 files changed, 18 insertions(+), 8 deletions(-) create mode 100755 build.sh diff --git a/Dockerfile b/Dockerfile index 0fa65edb..4bb6a22a 100644 --- a/Dockerfile +++ b/Dockerfile @@ -3,9 +3,9 @@ FROM ghcr.io/jamesdbrock/ihaskell-notebook:master # set up a user whose uid is 1000. It is bad practice to run processes in containers as root, and on binder we do not allow root container processes. ARG NB_USER=rober ARG NB_UID=1000 -ENV USER ${NB_USER} -ENV NB_UID ${NB_UID} -ENV HOME /home/${NB_USER} +ENV USER=${NB_USER} +ENV NB_UID=${NB_UID} +ENV HOME=/home/${NB_USER} USER root @@ -20,11 +20,11 @@ RUN pip install RISE RUN pip install jupyterthemes #RUN jt -t gruvboxd -T -N -kl -# ---- Add non-root user -#RUN adduser --disabled-password \ -# --gecos "Default user" \ -# --uid ${NB_UID} \ -# ${NB_USER} +# ---- Rename the existing UID 1000 user to the desired username +RUN existing=$(getent passwd ${NB_UID} | cut -d: -f1) && \ + if [ "${existing}" != "${NB_USER}" ]; then \ + usermod -l ${NB_USER} -d /home/${NB_USER} ${existing}; \ + fi # Make sure the contents of our repo are in ${HOME} COPY . ${HOME} diff --git a/build.sh b/build.sh new file mode 100755 index 00000000..f295292e --- /dev/null +++ b/build.sh @@ -0,0 +1,10 @@ +#!/bin/bash + +pushd "$(dirname "${BASH_SOURCE[0]}")" + +[[ -n ${1} ]] && + tagArgs=" -t ${1} " + +docker build --build-arg NB_USER=$(whoami) --build-arg NB_UID=$(id -u) ${tagArgs} . + +popd From df5b1955b2ee51244e605573f74690df814f8a5f Mon Sep 17 00:00:00 2001 From: Patrizio Bertoni Date: Tue, 3 Mar 2026 22:40:59 +0100 Subject: [PATCH 2/2] Fixed typos in lesson02, lesson04 ipynb --- lessons/02-Functions-Data-Types-and-Signatures.ipynb | 2 +- lessons/04-Pattern-matching.ipynb | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/lessons/02-Functions-Data-Types-and-Signatures.ipynb b/lessons/02-Functions-Data-Types-and-Signatures.ipynb index e93ec0af..925d25d8 100644 --- a/lessons/02-Functions-Data-Types-and-Signatures.ipynb +++ b/lessons/02-Functions-Data-Types-and-Signatures.ipynb @@ -1738,7 +1738,7 @@ }, "outputs": [], "source": [ - "prodForDubles :: Double -> Double -> Double\n", + "prodForDoubles :: Double -> Double -> Double\n", "prodForDoubles x y = x * y" ] }, diff --git a/lessons/04-Pattern-matching.ipynb b/lessons/04-Pattern-matching.ipynb index 6b733610..4ef96450 100644 --- a/lessons/04-Pattern-matching.ipynb +++ b/lessons/04-Pattern-matching.ipynb @@ -968,8 +968,8 @@ } ], "source": [ - "initials :: String -> String -> String\n", - "initials name lastName = if name == \"\" || lastName == \"\"\n", + "initials' :: String -> String -> String\n", + "initial's name lastName = if name == \"\" || lastName == \"\"\n", " then \"How was your name again?\"\n", " else let x = head name\n", " y = head lastName\n",