particle-os-cli/templates/Containerfile.tera
2024-01-01 18:38:39 +00:00

59 lines
2.2 KiB
Text

FROM {{ base_image }}:{{ image_version }}
LABEL org.opencontainers.image.title="{{ name }}"
LABEL org.opencontainers.image.version="{{ image_version }}"
LABEL org.opencontainers.image.description="{{ description }}"
LABEL io.artifacthub.package.readme-url=https://raw.githubusercontent.com/ublue-os/startingpoint/main/README.md
LABEL io.artifacthub.package.logo-url=https://avatars.githubusercontent.com/u/120078124?s=200&v=4
ARG RECIPE={{ recipe }}
{%- if running_gitlab_actions() %}
ARG IMAGE_REGISTRY=ghcr.io/ublue-os
COPY cosign.pub /usr/share/ublue-os/cosign.pub
{%- endif %}
# Copy the bling from ublue-os/bling into tmp, to be installed later by the bling module
# Feel free to remove these lines if you want to speed up image builds and don't want any bling
COPY --from=ghcr.io/ublue-os/bling:latest /rpms /tmp/bling/rpms
COPY --from=ghcr.io/ublue-os/bling:latest /files /tmp/bling/files
COPY --from=docker.io/mikefarah/yq /usr/bin/yq /usr/bin/yq
COPY --from=gcr.io/projectsigstore/cosign /ko-app/cosign /usr/bin/cosign
COPY config /tmp/config/
# Copy modules
# The default modules are inside ublue-os/bling
COPY --from=ghcr.io/ublue-os/bling:latest /modules /tmp/modules/
# Custom modules overwrite defaults
COPY modules /tmp/modules/
RUN printf {{ print_script(script = "export") }} >> /tmp/exports.sh && chmod +x /tmp/exports.sh
ARG CONFIG_DIRECTORY="/tmp/config"
ARG IMAGE_NAME="{{ name }}"
ARG BASE_IMAGE="{{ base_image }}"
{%- 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 && source /tmp/exports.sh && /tmp/modules/{{ module.type }}/{{ module.type }}.sh '{{ 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 %}
{{ self::run_modules(module = m) }}
{%- endfor %}
{%- endif %}
{%- endmacro run_modules %}
{%- for module in modules %}
{{ self::run_modules(module = module) }}
{%- endfor %}
RUN rm -rf /tmp/* /var/* && ostree container commit