bootstrap: docker
from: physino/geant4

%post
# prepare X11 based backend for matplotlib in Linux
dnf install -y python3-tkinter && dnf clean all && rm -fr /var/cache/*

# set GEANT4_DATA_DIR for non-login sh, such as the one
# created by apptainer shell library://..
# GEANT4_DATA_DIR is set in /etc/bashrc in physino/geant4
# that file will not be loaded by a non-login sh
# but files in /.singularity.d/env will be sourced
# accroding to https://stackoverflow.com/a/61251143
tail -20 /etc/bashrc >> /.singularity.d/env/99-base.sh

%runscript
# apptainer run and shell will not source host ~/.bashrc
# apptainer exec library://.. bash will
# apptainer exec library://.. bash --login will also source container
# /etc/bashrc, where alias and functions are defined
bash --login "$@"
