This will help make the Containerfile just a little bit easier to read (ignoring all the mounts lol). This would also allow us to add logic later to support modules that run executables other than `*.sh`.
41 lines
1.6 KiB
Django/Jinja
41 lines
1.6 KiB
Django/Jinja
# Key RUN
|
|
RUN --mount=type=bind,from=stage-keys,src=/keys,dst=/tmp/keys \
|
|
mkdir -p /usr/etc/pki/containers/ \
|
|
&& cp /tmp/keys/* /usr/etc/pki/containers/ \
|
|
&& ostree container commit
|
|
|
|
# Bin RUN
|
|
RUN --mount=type=bind,from=stage-bins,src=/bins,dst=/tmp/bins \
|
|
mkdir -p /usr/bin/ \
|
|
&& cp /tmp/bins/* /usr/bin/ \
|
|
&& ostree container commit
|
|
|
|
# Module RUNs
|
|
{%- for module in recipe.modules_ext.modules %}
|
|
{%- if let Some(type) = module.module_type %}
|
|
{%- if type == "containerfile" %}
|
|
{%- include "modules/containerfile/containerfile.j2" %}
|
|
{%- else %}
|
|
RUN \
|
|
{%- if files_dir_exists %}
|
|
--mount=type=bind,from=stage-files,src=/files,dst=/tmp/files,rw \
|
|
{%- else %}
|
|
--mount=type=bind,from=stage-config,src=/config,dst=/tmp/config,rw \
|
|
{%- endif %}
|
|
{%- if let Some(source) = module.source %}
|
|
--mount=type=bind,from={{ source }},src=/modules,dst=/tmp/modules,rw \
|
|
{%- else %}
|
|
--mount=type=bind,from=stage-modules,src=/modules,dst=/tmp/modules,rw \
|
|
{%- endif %}
|
|
{%- if type == "akmods" %}
|
|
--mount=type=bind,from=stage-akmods-{{ module.generate_akmods_info(os_version).stage_name }},src=/rpms,dst=/tmp/rpms,rw \
|
|
{%- endif %}
|
|
--mount=type=bind,from=ghcr.io/blue-build/cli:{{ exports_tag }}-build-scripts,src=/scripts/,dst=/tmp/scripts/ \
|
|
--mount=type=cache,dst=/var/cache/rpm-ostree,id=rpm-ostree-cache-{{ recipe.name }}-{{ recipe.image_version }},sharing=locked \
|
|
source /tmp/scripts/exports.sh \
|
|
&& /tmp/scripts/run_module.sh {{ type }} '{{ module.print_module_context() }}'
|
|
{%- endif %}
|
|
{%- endif %}
|
|
{%- endfor %}
|
|
|
|
|