FROM rancher/os-debianconsole-base
# FROM amd64=debian:jessie arm64=aarch64/debian:jessie arm=armhf/debian:jessie

ENV DAPPER_RUN_ARGS --privileged
ENV DAPPER_OUTPUT dist
RUN apt-get update -y
RUN DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \
    ca-certificates curl dosfstools tree zip
RUN mkdir -p /source/assets

# RancherOS for ARM
#RUN curl -fL https://releases.rancher.com/os/latest/rootfs_arm.tar.gz > /source/assets/rootfs_arm.tar.gz
COPY rootfs_arm.tar.gz /source/assets/rootfs_arm.tar.gz

# see https://packagecloud.io/Hypriot/rpi/?filter=debs
ENV URL=https://packagecloud.io/Hypriot/rpi/packages/debian/jessie/
# 4.4.50-hypriotos-v7+-1
ENV VER=20170319-133405

RUN curl -fL ${URL}/raspberrypi-kernel_${VER}_armhf.deb/download \
	> /source/assets/kernel.deb
RUN curl -fL ${URL}/raspberrypi-bootloader_${VER}_armhf.deb/download \
	> /source/assets/bootloader.deb

WORKDIR /source
CMD ["./scripts/build.sh"]
