Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 12 additions & 1 deletion Dockerfile.astera
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ ENV DEBIAN_FRONTEND=noninteractive \

RUN apt-get update && apt-get install -y --no-install-recommends \
bash \
bsdextrautils \
ca-certificates \
curl \
dnsutils \
Expand All @@ -44,6 +45,7 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
nano \
ncdu \
rsync \
tcsh \
tini \
tmux \
vim \
Expand All @@ -56,7 +58,7 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
&& install -m 0755 /app/run_experiments.sh /usr/local/bin/run_experiments.sh \
&& install -m 0755 /app/run_all_models.sh /usr/local/bin/run_all_models.sh \
&& for cmd in \
bash curl dig emacs git htop nano ncdu ping rsync tini tmux vim wget zsh; do \
bash column csh curl dig emacs git htop nano ncdu ping rsync tini tmux vim wget zsh; do \
command -v "${cmd}" >/dev/null 2>&1 || exit 1; \
done

Expand All @@ -68,6 +70,15 @@ RUN install -m 0644 \
&& EXT_VERSION="${EXT_VERSION}" bash /usr/local/share/sampleworks/astera/install-ext.sh \
&& bash /usr/local/share/sampleworks/astera/install-ext-shell-hooks.sh

# SBGrid lives on the shared sbgrid-programs PVC, auto-mounted read-only at
# /programs by the actl catalog. /programs is created empty so the guarded init
# is a clean no-op when the PVC is not mounted.
RUN mkdir -p /programs \
&& install -m 0644 \
/usr/local/share/sampleworks/astera/sbgrid-shell.sh \
/etc/profile.d/sbgrid-shell.sh \
&& bash /usr/local/share/sampleworks/astera/install-sbgrid-shell-hooks.sh

WORKDIR /home/dev

# ACTL workspace pods intentionally keep the inherited root runtime user: the
Expand Down
21 changes: 21 additions & 0 deletions docker/astera/install-sbgrid-shell-hooks.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#!/usr/bin/env bash
set -euo pipefail

# Wire the guarded SBGrid init into every shell actl might open, mirroring
# install-ext-shell-hooks.sh. Idempotent: re-running never double-appends.

profile_script="/etc/profile.d/sbgrid-shell.sh"
profile_comment="# Sampleworks: put SBGrid on \$PATH when /programs is mounted."
profile_line="[ -r ${profile_script} ] && . ${profile_script}"

touch /root/.bashrc /home/dev/.bashrc

for profile_file in /etc/bash.bashrc /root/.bashrc /home/dev/.bashrc /etc/zsh/zshrc /etc/zsh/zprofile; do
if [ ! -e "${profile_file}" ]; then
continue
fi
if grep -Fqs "${profile_line}" "${profile_file}"; then
continue
fi
printf '\n%s\n%s\n' "${profile_comment}" "${profile_line}" >> "${profile_file}"
done
20 changes: 20 additions & 0 deletions docker/astera/sbgrid-shell.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# Put the SBGrid collection on $PATH when it is mounted.
#
# SBGrid is a site installation on the shared `sbgrid-programs` PVC, which the
# actl catalog auto-mounts read-only at /programs for every diffuse profile. It
# is not part of this image — the collection is well over a terabyte — so this
# script must be a no-op whenever the mount is absent (any non-diffuse
# workspace, or a run with --no-mount). Every step is guarded accordingly:
# /programs is an ordinary empty directory without the PVC.
#
# Set SBGRID_NO_AUTOINIT=1 before shell start to opt out.

if [ -z "${SBGRID_NO_AUTOINIT:-}" ] && [ -z "${SBGRID_INITIALISED:-}" ] && [ -r /programs/sbgrid.shrc ]; then
SBGRID_INITIALISED=1
export SBGRID_INITIALISED
# sbgrid.shrc runs commands that return non-zero benignly, so it aborts
# under `set -e` and would take the whole shell with it. It is also chatty
# on first run and writes into $HOME. Neither should be able to break shell
# startup, hence the redirect and the `|| true`.
. /programs/sbgrid.shrc >/dev/null 2>&1 || true
fi
Loading