particle-os-cli/templates/Containerfile.legacy

93 lines
3 KiB
Text

FROM {{ base_image }}:{{ fedora_version }}
ARG RECIPE={{ recipe }}
COPY usr/ /usr
{% if usr_dir_overlays %}
{% for usr_dir in usr_dir_overlays %}
COPY {{ usr_dir }}/ /usr
{% endfor %}
{% endif %}
COPY ${RECIPE} /usr/share/ublue-os/recipe.yml
COPY --from=ghcr.io/ublue-os/bling:latest /rpms/ublue-os-wallpapers-0.1-1.fc38.noarch.rpm /tmp/ublue-os-wallpapers-0.1-1.fc38.noarch.rpm
COPY --from=ghcr.io/ublue-os/bling:latest /files/usr/share/ublue-os/just /usr/share/ublue-os/just
COPY --from=ghcr.io/ublue-os/bling:latest /files/usr/bin/ublue-nix* /usr/bin
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 scripts /tmp/scripts
RUN find /tmp/scripts -type f -exec chmod +x {} \;
{% if containerfiles and containerfiles.pre %}
# Pre: Containerfiles
{% for containerfile in containerfiles.pre %}
{{ print_containerfile(containerfile = containerfile) }}
{% endfor %}
{% endif %}
{{ print_autorun_scripts(mode = "pre") }}
{% if scripts and scripts.pre %}
{% for script in scripts.pre %}
RUN /bin/bash -c '/tmp/scripts/{{ script }} pre'
{% endfor %}
{% endif %}
{% if rpm and rpm.repos %}
{% for repo in rpm.repos %}
RUN wget "{{ repo }}" -P "/etc/yum.repos.d/"
{% endfor %}
{% endif %}
{% if rpm and rpm.remove %}
RUN rpm-ostree override remove {% for app in rpm.remove %}{{ app }} {% endfor %}
{% endif %}
ARG FIRSTBOOT_DATA="/usr/share/ublue-os/firstboot"
ARG FIRSTBOOT_LINK="/usr/etc/profile.d/ublue-firstboot.sh"
{% if firstboot.yafti -%}
RUN echo "-- firstboot: Installing and enabling \"yafti\" --"; \
pip install --prefix=/usr yafti; \
mkdir -p "$(dirname "${FIRSTBOOT_LINK}")"; \
ln -s "${FIRSTBOOT_DATA}/launcher/login-profile.sh" "${FIRSTBOOT_LINK}"
ARG YAFTI_FILE="${FIRSTBOOT_DATA}/yafti.yml"
RUN echo "-- yafti: Adding Flatpaks defined in recipe.yml --"; \
yq -i '.screens.applications.values.groups.Custom.description = "Flatpaks suggested by the image maintainer."' "${YAFTI_FILE}"; \
yq -i '.screens.applications.values.groups.Custom.default = true' "${YAFTI_FILE}"; \
{%- for pkg in firstboot.flatpaks %}
echo "Adding to yafti: {{ pkg }}"; \
yq -i ".screens.applications.values.groups.Custom.packages += [{\"{{ pkg }}\": \"{{ pkg }}\"}]" "${YAFTI_FILE}"; \
{%- endfor %}
echo "Done setting up Yafti"
{% else %}
RUN echo "-- firstboot: Removing all \"firstboot\" components --"; \
rm -f "${FIRSTBOOT_LINK}"; \
rm -rf "${FIRSTBOOT_DATA}"
{% endif %}
{% if rpm and rpm.install %}
RUN rpm-ostree install {% for app in rpm.install %}{{ app }} {% endfor %}
{% endif %}
{{ print_autorun_scripts(mode = "post") }}
{% if scripts and scripts.pre %}
{% for script in scripts.post -%}
RUN /bin/bash -c '/tmp/scripts/{{ script }} post'
{% endfor -%}
{% endif %}
{% if containerfiles and containerfiles.post %}
{% for containerfile in containerfiles.post %}
{{ print_containerfile(containerfile = containerfile) }}
{% endfor %}
{% endif %}
RUN rm -rf /tmp/* /var/* && ostree container commit