# SPDX-License-Identifier: Apache-2.0
#!BuildTag: rancher/elemental-iso/5.3:latest

FROM rancher/elemental-teal/5.3:latest AS os
FROM rancher/elemental-builder-image/5.3:latest AS builder

WORKDIR /iso

COPY manifest.yaml manifest.yaml
COPY --from=os / rootfs

# Version and Release values are taken from os image,
# they do not relate with the current build done here
RUN source rootfs/etc/os-release && \
    VER=${IMAGE_TAG%%-*} && REL=${IMAGE_TAG#*-} && \
    elemental --debug --config-dir . build-iso -o /output -n "elemental-teal.$(uname -m)-${VER}-Build${REL}" dir:rootfs

# Only keep the ISO as a result
FROM scratch
COPY --from=builder /output /iso
