Skip to content

Commit

Permalink
Expose installed binaries in application containers
Browse files Browse the repository at this point in the history
  • Loading branch information
loganharbour authored and Your Name committed Aug 28, 2024
1 parent 2b27159 commit 3e7096e
Showing 1 changed file with 17 additions and 4 deletions.
21 changes: 17 additions & 4 deletions apptainer/app.def
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
{#- METHOD: The method to build; defaults to "opt" -#}
{#- TEST_DIRS: Directories to test in the %test section; defaults to just "tests" -#}
{#- EXTRA_MAMBA_PACKAGES: Extra mamba packages to install -#}
{#- EXTRA_BINARIES: Colon separated list of extra binaries that this application installs -#}

{#- Civet Specific jinja arguments -#}
{#- CIVET_STEP_ALLOWED_TO_FAIL: BOOL, specific to Civet. Available in %post, %test section -#}
Expand All @@ -25,6 +26,13 @@
{#- The within-container build directory to use -#}
{%- set ROOT_BUILD_DIR = '/root/build' -%}

{%- if METHOD is not defined %}
{%- set METHOD = 'opt' -%}
{%- endif %}
{%- if TEST_DIRS is not defined %}
{%- set TEST_DIRS = 'tests' -%}
{%- endif %}

BootStrap: {{ APPTAINER_BOOTSTRAP }}
From: {{ APPTAINER_FROM }}

Expand Down Expand Up @@ -69,11 +77,16 @@ From: {{ APPTAINER_FROM }}
{%- endif %}

%environment
export INSTALLED_BINARIES={{ BINARY_NAME }}-{{ METHOD }}:exodiff:hit
{%- if BINARY_NAME == 'moose' %}
export PATH=/opt/moose/bin:$PATH
export INSTALLED_BINARIES=${INSTALLED_BINARIES}:moose_test-{{ METHOD }}
{%- else %}
export PATH=/opt/{{ BINARY_NAME }}/bin:$PATH
{%- endif %}
{%- if EXTRA_BINARIES is defined %}
export INSTALLED_BINARIES=${INSTALLED_BINARIES}:{{ EXTRA_BINARIES }}
{%- endif %}
{%- if SECTION_ENVIRONMENT is defined %}
{{ SECTION_ENVIRONMENT }}
{%- endif %}
Expand All @@ -85,7 +98,7 @@ From: {{ APPTAINER_FROM }}
# Load jinja vars
APPLICATION_NAME=$(basename {{ APPLICATION_DIR }})
BINARY_NAME={{ BINARY_NAME }}
export METHOD={{ METHOD or "opt" }}
export METHOD={{ METHOD }}
MOOSE_DOCS_FLAGS="{{ MOOSE_DOCS_FLAGS }}"
export MOOSE_JOBS={{ MOOSE_JOBS or "1" }}
MOOSE_OPTIONS="{{ MOOSE_OPTIONS }}"
Expand Down Expand Up @@ -148,7 +161,7 @@ From: {{ APPTAINER_FROM }}
make install -j ${MOOSE_JOBS} MOOSE_SKIP_DOCS=1
# Create moose-opt symlink to combined-opt
cd /opt/moose/bin
ln -s combined-opt moose-opt
ln -s combined-${METHOD} moose-${METHOD}
{%- endif %}

# Fix permissions for installed application
Expand All @@ -165,8 +178,8 @@ From: {{ APPTAINER_FROM }}

# Load jinja vars
export BINARY_NAME={{ BINARY_NAME }}
export METHOD={{ METHOD or "opt" }}
TEST_DIRS="{{ TEST_DIRS or "tests" }}"
export METHOD={{ METHOD }}
TEST_DIRS="{{ TEST_DIRS }}"
# Temp location for copying and running in
export TEMP_LOC=$(mktemp -d /tmp/${BINARY_NAME}test.XXXXXX)
# Really make sure that we nuke the temp location in all circumstances
Expand Down

0 comments on commit 3e7096e

Please sign in to comment.