## ## This docker file will build a base image for building Erlang/OTP ## ARG BASE=debian:bullseye FROM $BASE ## Need to have a second arg here as the first does not expose the $BASE in the script below ARG BASE=debian:bullseye ARG HOST_TRIP=x86_64-linux-gnu ENV HOST_TRIP=$HOST_TRIP ENV LANG=C.UTF-8 ENV LC_ALL=C.UTF-8 ENV INSTALL_LIBS="zlib1g-dev libncurses5-dev libssl-dev unixodbc-dev libgmp3-dev libwxgtk3.0-gtk3-dev libwxgtk-webview3.0-gtk3-dev libsctp-dev lksctp-tools" ENV CROSS_LIBS="zlib1g-dev libncurses5-dev libssl-dev unixodbc-dev libgmp3-dev libwxgtk3.0-gtk3-dev libsctp-dev lksctp-tools" ## See https://wiki.debian.org/Multiarch/HOWTO for details on how to install things ## ## 1. Install build-essential to get access to dpkg-architecture ## 2. Use dpkg-architecture to figure out what we are running on ## 3. If the HOST_TRIP does not equal BUILD_TRIP we should cross compile RUN apt-get update && apt-get -y upgrade && apt-get install -y build-essential && \ BUILD_TRIP=`dpkg-architecture -t${HOST_TRIP} -qDEB_BUILD_MULTIARCH` && \ BUILD_ARCH=`dpkg-architecture -t${HOST_TRIP} -qDEB_BUILD_ARCH` && \ if [ "$HOST_TRIP" != "$BUILD_TRIP" ]; then \ HOST_ARCH=`dpkg-architecture -t${HOST_TRIP} -qDEB_HOST_ARCH` && \ dpkg --add-architecture $HOST_ARCH && \ sed -i "s:deb http:deb [arch=$BUILD_ARCH,$HOST_ARCH] http:g" /etc/apt/sources.list; \ fi && \ apt-get update && \ apt-get install -y build-essential m4 autoconf fop xsltproc default-jdk libxml2-utils \ $INSTALL_LIBS && \ if [ "$HOST_TRIP" != "$BUILD_TRIP" ]; then \ apt-get install -y -f \ crossbuild-essential-$HOST_ARCH \ $(for LIB in $CROSS_LIBS; do echo "$LIB:$HOST_ARCH"; done) && \ for dir in `find / -type d -name $HOST_TRIP`; do \ echo -n "$dir: /buildroot/sysroot"; \ echo `dirname $dir`; \ mkdir -p /buildroot/sysroot$dir; \ cp -r `dirname $dir`/* `dirname /buildroot/sysroot$dir`; \ cp -r $dir/* `dirname /buildroot/sysroot$dir`; \ done; \ fi && \ update-alternatives --set wx-config /usr/lib/${BUILD_TRIP}/wx/config/gtk3-unicode-3.0 && \ rm -rf /var/lib/apt/lists/*