# Define builder target
ARG DEB_RELEASE
FROM debian:${DEB_RELEASE}-slim as builder

# Environment PATH HOME HOSTNAME
# ENV PATH /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
# ENV HOME /

ARG DEB_RELEASE
RUN printf '#------------------------------------------------------------------------------#\
\n#                   OFFICIAL DEBIAN REPOS\
\n#------------------------------------------------------------------------------#\
\n# apt install curl wget apt-transport-https dirmngr\
\n\
\n###### Debian Main Repos\
\ndeb     http://deb.debian.org/debian/		'${DEB_RELEASE}'			main # contrib non-free\
\ndeb-src http://deb.debian.org/debian/		'${DEB_RELEASE}'			main # contrib non-free\
\n\
\n# stretch-updates, previously known as "volatile"\
\ndeb     http://deb.debian.org/debian/		'${DEB_RELEASE}'-updates		main # contrib non-free\
\ndeb-src http://deb.debian.org/debian/		'${DEB_RELEASE}'-updates		main # contrib non-free\
\n\
\ndeb     http://deb.debian.org/debian-security	'${DEB_RELEASE}'/updates		main\
\ndeb-src http://deb.debian.org/debian-security	'${DEB_RELEASE}'/updates		main\
\n\
\n# stretch-backports, previously on backports.debian.org\n\
\ndeb     http://ftp.debian.org/debian		'${DEB_RELEASE}'-backports	main\
\ndeb-src http://ftp.debian.org/debian		'${DEB_RELEASE}'-backports	main\
' >> /etc/apt/sources.list

RUN cat /etc/apt/sources.list


# Build deps and clean up
ARG BUILD_DEPS
RUN export DEBIAN_FRONTEND=noninteractive && \
    dpkg --add-architecture armhf && \
    apt-get -q  update && \
    apt-get -qy -o Dpkg::Use-Pty=0 upgrade && \
    apt-get -qy -o Dpkg::Use-Pty=0 install --no-install-recommends ${BUILD_DEPS} \
        build-essential crossbuild-essential-armhf debhelper ca-certificates curl git iproute2 wget nano && \
    apt-get clean && rm -rf /var/lib/apt/lists/*

# Default command
CMD ["bash"]

