From 9564ca0af36cb9ba26ba6c158dd1e24db90deee5 Mon Sep 17 00:00:00 2001 From: Gerald Pinder Date: Fri, 27 Oct 2023 17:53:32 -0400 Subject: [PATCH] feat(modules)!: Allow containerfile module to print out to main Containerfile --- templates/Containerfile.modules | 19 ++++++------------- 1 file changed, 6 insertions(+), 13 deletions(-) diff --git a/templates/Containerfile.modules b/templates/Containerfile.modules index 58797d0..35b02b4 100644 --- a/templates/Containerfile.modules +++ b/templates/Containerfile.modules @@ -27,17 +27,16 @@ ARG CONFIG_DIRECTORY="/tmp/config" ARG IMAGE_NAME="{{ name }}" ARG BASE_IMAGE="{{ base_image }}" -{% if containerfiles and containerfiles.pre %} -# Pre: Containerfiles - {% for containerfile in containerfiles.pre %} -{{ print_containerfile(containerfile = containerfile) }} - {% endfor %} -{% endif %} - {% macro run_modules(module) %} {% if module.type %} + {% if module.type == "containerfile" %} + {% for c in module.containerfiles %} +{{ print_containerfile(containerfile = c ) }} + {% endfor %} + {% else %} RUN chmod +x /tmp/modules/{{ module.type }}/{{ module.type }}.sh RUN source /tmp/exports.sh && OS_VERSION="$(grep -Po '(?<=VERSION_ID=)\d+' /usr/lib/os-release)" /tmp/modules/{{ module.type }}/{{ module.type }}.sh "$(echo -e "{{ print_module_context(module = module) }}")" + {% endif %} {% elif module["from-file"] %} {% set extra_module = get_module_from_file(file = module["from-file"]) %} {% for m in extra_module.modules %} @@ -50,10 +49,4 @@ RUN source /tmp/exports.sh && OS_VERSION="$(grep -Po '(?<=VERSION_ID=)\d+' /usr/ {{ self::run_modules(module = module) }} {% endfor %} -{% if containerfiles and containerfiles.post %} - {% for containerfile in containerfiles.post %} -{{ print_containerfile(containerfile = containerfile) }} - {% endfor %} -{% endif %} - RUN rm -rf /tmp/* /var/* && ostree container commit