# We're using a multistage Docker build here in order to allow us to release a self-verifying
# Docker image when built on the official Docker infrastructure.
# They require us to verify the source integrity in some way while making sure that this is a
# reproducible build.
# See https://github.com/docker-library/official-images#image-build
# In order to achieve this, we externally host the rootfs archives and their checksums and then
# just download and verify it in the first stage of this Dockerfile.
# The second stage is for actually configuring the system a little bit.
# Some templating is done in order to allow us to easily build different configurations and to
# allow us to automate the releaes process.tazpkg install ghost-5.0.1.tazpkg --root=$ISO_PATH/rootfs --nodeps --local

FROM slitazcn/slitaz-5.0-base
COPY ./iso-old/boot/rootfs.gz ./packages/* ./
RUN mkdir -p /tmp/rootfs && \
	ls -l && \
	mv rootfs.gz /tmp/rootfs && \
	cd /tmp/rootfs && \
	(zcat rootfs.gz 2>/dev/null || lzma d rootfs.gz -so) | cpio -id && \
	rm rootfs.gz && \
	cd / && \
	sh /gen-slitaz64.sh && \
	cd /tmp/rootfs && \
	ls -l && \
	find . -print | cpio -o -H newc | lzma e -si -so > ../rootfs-new.gz

