-
Notifications
You must be signed in to change notification settings - Fork 2
Description
In preparation for supporting denv-based interaction with ldmx-sw, we can move away from our custom entrypoint script and towards are more general method for initializing the container environment upon launch.
denv
copies the files from /etc/skel
into the workspace which acts as the user's home directory within the containerized development environment. This means, if we update those files with our environment customization in the container image, the updates will be picked up by users of the image when running with denv.
The following lines could be copied or moved into a file that should be appended to /etc/skel/.profile
.
COPY ./env-init.sh /etc/env-init.sh
RUN cat /etc/env-init.sh >> /etc/skel/.profile
We do not need to copy the MPL config export since the new home directory when running with denv will be the denv workspace and so it will be usable by MPL's default path in the home directory. The directory movement and eval
command are entrypoint specific.
I think we can then rewrite the entrypoint as
. /etc/env-init.sh
# puts a config/cache directory for matplotlib to use
export MPLCONFIGDIR=$LDMX_BASE/.config/matplotlib
# go to first argument
cd "$1"
# execute the rest as a one-liner command
eval "${@:2}"
If we wanted to avoid code duplication; however, this would disable using relative paths in LDMX_CUSTOM_GEANT4
since that stuff is now being done before the cd
, but I think that is okay.