From: Matthew Newton Date: Thu, 14 Dec 2017 23:49:02 +0000 (+0000) Subject: reorganise/regularise dockerfiles, smaller image, args for compiler ver X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=3ab13a6dfd236443f485ca0d1d1b76ac4fb556ae;p=thirdparty%2Ffreeradius-server.git reorganise/regularise dockerfiles, smaller image, args for compiler ver --- diff --git a/scripts/docker/build-centos6/Dockerfile.deps b/scripts/docker/build-centos6/Dockerfile.deps index 2c115efb8cc..5b71a1dff2d 100644 --- a/scripts/docker/build-centos6/Dockerfile.deps +++ b/scripts/docker/build-centos6/Dockerfile.deps @@ -25,7 +25,7 @@ ENV CC=/opt/rh/devtoolset-3/root/usr/bin/gcc # Setup a src dir in /usr/local # RUN mkdir -p /usr/local/src/repositories -WORKDIR /usr/local/src +WORKDIR /usr/local/src/repositories # # Get a modern version of cmake. We need 3.8.2 or later to build libkqueue rpms @@ -38,13 +38,13 @@ RUN sh cmake.sh --skip-license --prefix=/usr/local # Grab libkqueue and build # WORKDIR /usr/local/src/repositories -# Fixme: Change to the main repo when they merge this branch RUN git clone --branch master --depth=1 https://github.com/mheily/libkqueue.git + WORKDIR libkqueue RUN cmake -G "Unix Makefiles" -DCMAKE_INSTALL_PREFIX=/usr -DCMAKE_INSTALL_LIBDIR=lib ./ && \ make && \ - cpack -G RPM -RUN yum localinstall -y *.rpm + cpack -G RPM && \ + yum localinstall -y *.rpm # # Use LTB's openldap packages intead of the distribution version to avoid linking against NSS @@ -74,23 +74,27 @@ RUN v=$(rpm -q --qf '%{VERSION}\n' --specfile hiredis/redhat/hiredis.spec | head rpmbuild -bb hiredis-$v/redhat/hiredis.spec RUN yum localinstall -y $HOME/rpmbuild/RPMS/*/hiredis-*.rpm +WORKDIR /usr/local/src/repositories + # # Shallow clone the FreeRADIUS source # -WORKDIR /usr/local/src/repositories ARG source=https://github.com/FreeRADIUS/freeradius-server.git RUN git clone --depth 1 ${source} - WORKDIR freeradius-server -# Install build dependencies for all branches +# +# Install build dependencies for all branches +# RUN for i in $(git for-each-ref --format='%(refname:short)' refs/remotes/origin 2>/dev/null | sed -e 's#origin/##' | egrep "^v[0-9]*\.[0-9x]*\.x$");\ do \ git checkout $i; \ [ -e redhat/freeradius.spec ] && yum-builddep -y redhat/freeradius.spec; \ done -# Create the build tree +# +# Create the RPM build tree +# ENV BUILDDIR=/root/rpmbuild RUN rpmdev-setuptree diff --git a/scripts/docker/build-centos7/Dockerfile.deps b/scripts/docker/build-centos7/Dockerfile.deps index e87efd0f7ad..bcb2ec054d2 100644 --- a/scripts/docker/build-centos7/Dockerfile.deps +++ b/scripts/docker/build-centos7/Dockerfile.deps @@ -24,7 +24,7 @@ ENV CC=/opt/rh/devtoolset-3/root/usr/bin/gcc # Setup a src dir in /usr/local # RUN mkdir -p /usr/local/src/repositories -WORKDIR /usr/local/src +WORKDIR /usr/local/src/repositories # # Get a modern version of cmake. We need 3.8.2 or later to build libkqueue rpms @@ -37,13 +37,13 @@ RUN sh cmake.sh --skip-license --prefix=/usr/local # Grab libkqueue and build # WORKDIR /usr/local/src/repositories -# Fixme: Change to the main repo when they merge this branch RUN git clone --branch master --depth=1 https://github.com/mheily/libkqueue.git + WORKDIR libkqueue RUN cmake -G "Unix Makefiles" -DCMAKE_INSTALL_PREFIX=/usr -DCMAKE_INSTALL_LIBDIR=lib ./ && \ make && \ - cpack -G RPM -RUN yum localinstall -y *.rpm + cpack -G RPM && \ + yum localinstall -y *.rpm # # Use LTB's openldap packages intead of the distribution version to avoid linking against NSS @@ -57,23 +57,27 @@ gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-LTB-project'\ > /etc/yum.repos.d/ltb-project.repo RUN rpm --import https://ltb-project.org/lib/RPM-GPG-KEY-LTB-project +WORKDIR /usr/local/src/repositories + # # Shallow clone the FreeRADIUS source # -WORKDIR /usr/local/src/repositories ARG source=https://github.com/FreeRADIUS/freeradius-server.git RUN git clone --depth 1 --no-single-branch ${source} - WORKDIR freeradius-server -# Install build dependencies for all branches +# +# Install build dependencies for all branches +# RUN for i in $(git for-each-ref --format='%(refname:short)' refs/remotes/origin 2>/dev/null | sed -e 's#origin/##' | egrep "^v[0-9]*\.[0-9x]*\.x$");\ do \ git checkout $i; \ [ -e redhat/freeradius.spec ] && yum-builddep -y redhat/freeradius.spec; \ done -# Create the build tree +# +# Create the RPM build tree +# ENV BUILDDIR=/root/rpmbuild RUN rpmdev-setuptree diff --git a/scripts/docker/build-debian8/Dockerfile.deps b/scripts/docker/build-debian8/Dockerfile.deps index 545d6c55f45..b0187323e87 100644 --- a/scripts/docker/build-debian8/Dockerfile.deps +++ b/scripts/docker/build-debian8/Dockerfile.deps @@ -1,43 +1,63 @@ FROM debian:jessie -RUN apt-get update && apt-get install -y devscripts equivs git quilt software-properties-common python-software-properties +ARG gccver=4.9 +ARG clangver=5.0 +ARG osname=jessie # -# For GCC 4.9 +# Install add-apt-repository # -RUN apt-get install -y g++-4.9 -RUN update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-4.9 50 --slave /usr/bin/g++ g++ /usr/bin/g++-4.9 && update-alternatives --config gcc +RUN apt-get update && \ + apt-get install -y software-properties-common && \ + apt-get clean && \ + rm -r /var/lib/apt/lists/* -# -# For clang 5.0 -# -RUN add-apt-repository "http://apt.llvm.org/jessie/ llvm-toolchain-jessie-5.0 main" -RUN apt-key adv --fetch-keys http://apt.llvm.org/llvm-snapshot.gpg.key -RUN apt-get update -RUN apt-get install -y llvm-5.0 clang-5.0 lldb-5.0 +# Requires GCC-4.9 as it has support for C11 keywords and atomics -RUN update-alternatives --install /usr/bin/clang clang /usr/bin/clang-5.0 60 && update-alternatives --config clang -RUN update-alternatives --install /usr/bin/lldb lldb /usr/bin/lldb-5.0 60 && update-alternatives --config lldb +# For clang +RUN add-apt-repository -y "deb http://apt.llvm.org/${osname}/ llvm-toolchain-${osname}-${clangver} main" && \ + apt-key adv --fetch-keys http://apt.llvm.org/llvm-snapshot.gpg.key + +RUN apt-get update && \ +# Development utilities + apt-get install -y devscripts equivs git quilt && \ +# Compilers + apt-get install -y g++-${gccver} llvm-${clangver} clang-${clangver} lldb-${clangver} && \ +# eapol_test dependencies + apt-get install -y libnl-3-dev libnl-genl-3-dev + +RUN update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-${gccver} 50 \ + --slave /usr/bin/g++ g++ /usr/bin/g++-${gccver} && \ + update-alternatives --config gcc + +RUN update-alternatives --install /usr/bin/clang clang /usr/bin/clang-${clangver} 60 && \ + update-alternatives --config clang + +RUN update-alternatives --install /usr/bin/lldb lldb /usr/bin/lldb-${clangver} 60 && \ + update-alternatives --config lldb -# -# Install eapol_test dependencies -# -RUN apt-get install -y libnl-3-dev libnl-genl-3-dev # # Setup a src dir in /usr/local # +RUN mkdir -p /usr/local/src/repositories WORKDIR /usr/local/src/repositories -RUN git clone --depth=1 --no-single-branch https://github.com/FreeRADIUS/freeradius-server.git + +# +# Shallow clone the FreeRADIUS source +# +ARG source=https://github.com/FreeRADIUS/freeradius-server.git +RUN git clone --depth 1 --no-single-branch ${source} WORKDIR freeradius-server -# Install build dependencies for all branches +# +# Install build dependencies for all branches +# RUN for i in $(git for-each-ref --format='%(refname:short)' refs/remotes/origin 2>/dev/null | sed -e 's#origin/##' | egrep "^v[0-9]*\.[0-9x]*\.x$");\ do \ git checkout $i; \ - [ -e ./debian/control.in ] && debian/rules debian/control && echo 'y' | mk-build-deps -irt'apt-get -yV' debian/control; \ + if [ -e ./debian/control.in ] ; then debian/rules debian/control ; fi ; echo 'y' | mk-build-deps -irt'apt-get -yV' debian/control ; \ done ### For some reason this dep was not installed # RUN apt-get install -y libiodbc2-dev - diff --git a/scripts/docker/build-debian9/Dockerfile.deps b/scripts/docker/build-debian9/Dockerfile.deps index bd6f01967aa..2ea2fefc16a 100644 --- a/scripts/docker/build-debian9/Dockerfile.deps +++ b/scripts/docker/build-debian9/Dockerfile.deps @@ -1,32 +1,47 @@ FROM debian:stretch -RUN apt-get update && apt-get install -y devscripts equivs git quilt software-properties-common python-software-properties +ARG gccver=6 +ARG clangver=5.0 +ARG osname=stretch # -# Stretch uses GCC 4.9 by default, so we don't need to install any additional compilers to get C11 functionality +# Install add-apt-repository # +RUN apt-get update && \ + apt-get install -y software-properties-common && \ + apt-get clean && \ + rm -r /var/lib/apt/lists/* -# -# For clang 5.0 -# -RUN add-apt-repository "deb http://apt.llvm.org/stretch/ llvm-toolchain-stretch-5.0 main" -RUN apt-key adv --fetch-keys http://apt.llvm.org/llvm-snapshot.gpg.key -RUN apt-get update -RUN apt-get install -y llvm-5.0 clang-5.0 lldb-5.0 +# Stretch uses GCC-6.3 by default, so it doesn't need to be updated to get C11 functionality. -RUN update-alternatives --install /usr/bin/clang clang /usr/bin/clang-5.0 60 && update-alternatives --config clang -RUN update-alternatives --install /usr/bin/lldb lldb /usr/bin/lldb-5.0 60 && update-alternatives --config lldb +# For clang +RUN add-apt-repository -y "deb http://apt.llvm.org/${osname}/ llvm-toolchain-${osname}-${clangver} main" && \ + apt-key adv --fetch-keys http://apt.llvm.org/llvm-snapshot.gpg.key + +RUN apt-get update && \ +# Development utilities + apt-get install -y devscripts equivs git quilt && \ +# Compilers + apt-get install -y g++-${gccver} llvm-${clangver} clang-${clangver} lldb-${clangver} && \ +# eapol_test dependencies + apt-get install -y libnl-3-dev libnl-genl-3-dev + +RUN update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-${gccver} 50 \ + --slave /usr/bin/g++ g++ /usr/bin/g++-${gccver} && \ + update-alternatives --config gcc + +RUN update-alternatives --install /usr/bin/clang clang /usr/bin/clang-${clangver} 60 && \ + update-alternatives --config clang + +RUN update-alternatives --install /usr/bin/lldb lldb /usr/bin/lldb-${clangver} 60 && \ + update-alternatives --config lldb -# -# Install eapol_test dependencies -# -RUN apt-get install -y libnl-3-dev libnl-genl-3-dev # # Setup a src dir in /usr/local # RUN mkdir -p /usr/local/src/repositories -WORKDIR /usr/local/src +WORKDIR /usr/local/src/repositories # # Get a modern version of cmake. We need 3.8.2 or later to build libkqueue rpms @@ -39,18 +54,19 @@ RUN sh cmake.sh --skip-license --prefix=/usr/local # Grab libkqueue and build # WORKDIR /usr/local/src/repositories -# Fixme: Change to the main repo when they merge this branch RUN git clone --branch master --depth=1 https://github.com/mheily/libkqueue.git + WORKDIR libkqueue RUN cmake -G "Unix Makefiles" -DCMAKE_INSTALL_PREFIX=/usr -DCMAKE_INSTALL_LIBDIR=lib ./ && \ make && \ - cpack -P libkqueue-dev -G DEB -RUN apt-get install -y ./*.deb + cpack -P libkqueue-dev -G DEB && \ + dpkg -i --force-all ./libkqueue-*deb + +WORKDIR /usr/local/src/repositories # # Shallow clone the FreeRADIUS source # -WORKDIR /usr/local/src/repositories ARG source=https://github.com/FreeRADIUS/freeradius-server.git RUN git clone --depth 1 --no-single-branch ${source} WORKDIR freeradius-server @@ -61,6 +77,6 @@ WORKDIR freeradius-server RUN for i in $(git for-each-ref --format='%(refname:short)' refs/remotes/origin 2>/dev/null | sed -e 's#origin/##' | egrep "^v[0-9]*\.[0-9x]*\.x$");\ do \ git checkout $i; \ - [ -e ./debian/control.in ] && debian/rules debian/control && echo 'y' | mk-build-deps -irt'apt-get -yV' debian/control; \ + if [ -e ./debian/control.in ] ; then debian/rules debian/control ; fi ; echo 'y' | mk-build-deps -irt'apt-get -yV' debian/control ; \ done diff --git a/scripts/docker/build-ubuntu14/Dockerfile.deps b/scripts/docker/build-ubuntu14/Dockerfile.deps index d7fab242df0..d21be7f7cf4 100644 --- a/scripts/docker/build-ubuntu14/Dockerfile.deps +++ b/scripts/docker/build-ubuntu14/Dockerfile.deps @@ -1,30 +1,43 @@ FROM ubuntu:14.04 -RUN apt-get update && apt-get install -y devscripts equivs git quilt software-properties-common python-software-properties +ARG gccver=4.9 +ARG clangver=5.0 +ARG osname=trusty # -# For GCC 4.9 +# Install add-apt-repository # -RUN add-apt-repository ppa:ubuntu-toolchain-r/test -RUN apt-get update -RUN apt-get install -y g++-4.9 -RUN update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-4.9 50 --slave /usr/bin/g++ g++ /usr/bin/g++-4.9 && update-alternatives --config gcc +RUN apt-get update && \ + apt-get install -y software-properties-common python-software-properties && \ + apt-get clean && \ + rm -r /var/lib/apt/lists/* -# -# For Clang 5.0 -# -RUN add-apt-repository "deb http://apt.llvm.org/trusty/ llvm-toolchain-trust-5.0 main" -RUN apt-key adv --fetch-keys http://apt.llvm.org/llvm-snapshot.gpg.key -RUN apt-get update -RUN apt-get install -y llvm-5.0 clang-5.0 lldb-5.0 +# Requires GCC-4.9 as it has support for C11 keywords and atomics -RUN update-alternatives --install /usr/bin/clang clang /usr/bin/clang-5.0 60 && update-alternatives --config clang -RUN update-alternatives --install /usr/bin/lldb lldb /usr/bin/lldb-5.0 60 && update-alternatives --config lldb +# For clang +RUN add-apt-repository -y "deb http://apt.llvm.org/${osname}/ llvm-toolchain-${osname}-${clangver} main" && \ + apt-key adv --fetch-keys http://apt.llvm.org/llvm-snapshot.gpg.key && \ +# For GCC + add-apt-repository -y ppa:ubuntu-toolchain-r/test + +RUN apt-get update && \ +# Development utilities + apt-get install -y devscripts equivs git quilt && \ +# Compilers + apt-get install -y g++-${gccver} llvm-${clangver} clang-${clangver} lldb-${clangver} && \ +# eapol_test dependencies + apt-get install -y libnl-3-dev libnl-genl-3-dev + +RUN update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-${gccver} 50 \ + --slave /usr/bin/g++ g++ /usr/bin/g++-${gccver} && \ + update-alternatives --config gcc + +RUN update-alternatives --install /usr/bin/clang clang /usr/bin/clang-${clangver} 60 && \ + update-alternatives --config clang + +RUN update-alternatives --install /usr/bin/lldb lldb /usr/bin/lldb-${clangver} 60 && \ + update-alternatives --config lldb -# -# Install eapol_test dependencies -# -RUN apt-get install -y libnl-3-dev libnl-genl-3-dev # # Setup a src dir in /usr/local @@ -43,13 +56,14 @@ RUN sh cmake.sh --skip-license --prefix=/usr/local # Grab libkqueue and build # WORKDIR /usr/local/src/repositories -# Fixme: Change to the main repo when they merge this branch RUN git clone --branch master --depth=1 https://github.com/mheily/libkqueue.git + WORKDIR libkqueue RUN cmake -G "Unix Makefiles" -DCMAKE_INSTALL_PREFIX=/usr -DCMAKE_INSTALL_LIBDIR=lib ./ && \ make && \ - cpack -P libkqueue-dev -G DEB -RUN dpkg -i --force-all ./libkqueue-*deb + cpack -P libkqueue-dev -G DEB && \ + dpkg -i --force-all ./libkqueue-*deb + WORKDIR /usr/local/src/repositories # diff --git a/scripts/docker/build-ubuntu16/Dockerfile.deps b/scripts/docker/build-ubuntu16/Dockerfile.deps index 088e6332eed..a8900a243ea 100644 --- a/scripts/docker/build-ubuntu16/Dockerfile.deps +++ b/scripts/docker/build-ubuntu16/Dockerfile.deps @@ -1,30 +1,43 @@ FROM ubuntu:16.04 -RUN apt-get update && apt-get install -y devscripts equivs git quilt software-properties-common python-software-properties +ARG gccver=4.9 +ARG clangver=5.0 +ARG osname=xenial # -# For GCC 4.9 +# Install add-apt-repository # -RUN add-apt-repository ppa:ubuntu-toolchain-r/test -RUN apt-get update -RUN apt-get install -y g++-4.9 -RUN update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-4.9 50 --slave /usr/bin/g++ g++ /usr/bin/g++-4.9 && update-alternatives --config gcc +RUN apt-get update && \ + apt-get install -y software-properties-common python-software-properties && \ + apt-get clean && \ + rm -r /var/lib/apt/lists/* -# -# For clang 5.0 -# -RUN add-apt-repository "deb http://apt.llvm.org/xenial/ llvm-toolchain-xenial-5.0 main" -RUN apt-key adv --fetch-keys http://apt.llvm.org/llvm-snapshot.gpg.key -RUN apt-get update -RUN apt-get install -y llvm-5.0 clang-5.0 lldb-5.0 +# Requires GCC-4.9 as it has support for C11 keywords and atomics -RUN update-alternatives --install /usr/bin/clang clang /usr/bin/clang-5.0 60 && update-alternatives --config clang -RUN update-alternatives --install /usr/bin/lldb lldb /usr/bin/lldb-5.0 60 && update-alternatives --config lldb +# For clang +RUN add-apt-repository -y "deb http://apt.llvm.org/${osname}/ llvm-toolchain-${osname}-${clangver} main" && \ + apt-key adv --fetch-keys http://apt.llvm.org/llvm-snapshot.gpg.key && \ +# For GCC + add-apt-repository -y ppa:ubuntu-toolchain-r/test + +RUN apt-get update && \ +# Development utilities + apt-get install -y devscripts equivs git quilt && \ +# Compilers + apt-get install -y g++-${gccver} llvm-${clangver} clang-${clangver} lldb-${clangver} && \ +# eapol_test dependencies + apt-get install -y libnl-3-dev libnl-genl-3-dev + +RUN update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-${gccver} 50 \ + --slave /usr/bin/g++ g++ /usr/bin/g++-${gccver} && \ + update-alternatives --config gcc + +RUN update-alternatives --install /usr/bin/clang clang /usr/bin/clang-${clangver} 60 && \ + update-alternatives --config clang + +RUN update-alternatives --install /usr/bin/lldb lldb /usr/bin/lldb-${clangver} 60 && \ + update-alternatives --config lldb -# -# Install eapol_test dependencies -# -RUN apt-get -y install libnl-3-dev libnl-genl-3-dev # # Setup a src dir in /usr/local @@ -43,13 +56,14 @@ RUN sh cmake.sh --skip-license --prefix=/usr/local # Grab libkqueue and build # WORKDIR /usr/local/src/repositories -# Fixme: Change to the main repo when they merge this branch RUN git clone --branch master --depth=1 https://github.com/mheily/libkqueue.git + WORKDIR libkqueue RUN cmake -G "Unix Makefiles" -DCMAKE_INSTALL_PREFIX=/usr -DCMAKE_INSTALL_LIBDIR=lib ./ && \ make && \ - cpack -P libkqueue-dev -G DEB -RUN dpkg -i --force-all ./libkqueue-*deb + cpack -P libkqueue-dev -G DEB && \ + dpkg -i --force-all ./libkqueue-*deb + WORKDIR /usr/local/src/repositories #