FROM alpine:3.14 AS stage ARG PLATFORMS="@@@PLATFORMS@@@" ARG TOOLKIT_VER="@@@TOOLKIT_VER@@@" # Copy downloaded toolkits ADD cache /cache # Extract toolkits RUN for V in ${PLATFORMS}; do \ echo "${V}" | while IFS=':' read PLATFORM KVER; do \ echo "Extracting ds.${PLATFORM}-${TOOLKIT_VER}.dev.txz" && \ mkdir "/opt/${PLATFORM}" && \ tar -xaf "/cache/ds.${PLATFORM}-${TOOLKIT_VER}.dev.txz" -C "/opt/${PLATFORM}" --strip-components=10 \ "usr/local/x86_64-pc-linux-gnu/x86_64-pc-linux-gnu/sys-root/usr/lib/modules/DSM-${TOOLKIT_VER}/build" && \ echo -e "${PLATFORM}\t${KVER}" >> /opt/platforms && \ if [ ! -d "/opt/linux-${KVER}" ]; then \ mkdir "/opt/linux-${KVER}" && \ echo "Extracting linux-${KVER}.tar.xz" && \ tar -xaf "/cache/linux-${KVER}.tar.xz" -C "/opt/linux-${KVER}" --strip-components=1; \ fi; \ done; \ done # Final image FROM debian:8-slim ENV SHELL=/bin/bash \ ARCH=x86_64 RUN apt update --yes && \ apt install --yes --no-install-recommends --no-install-suggests \ ca-certificates nano curl bc kmod git \ build-essential make ncurses-dev libssl-dev autogen automake pkg-config libtool xsltproc gperf && \ apt-get clean && \ rm -rf /var/lib/apt/lists/* COPY --from=stage /opt /opt COPY files/ / WORKDIR /input VOLUME /input /output ENTRYPOINT ["/opt/do.sh"]