Skip to content

Copy environment setup to /etc/skel/.profile #94

@tomeichlersmith

Description

@tomeichlersmith

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

https://github.com/LDMX-Software/docker/blob/7db19f6084058fadfa4ef34177ff3b3157aa7c62/entry.sh#L25-L43

https://github.com/LDMX-Software/docker/blob/7db19f6084058fadfa4ef34177ff3b3157aa7c62/entry.sh#L52-L100

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions