# Dockerfile - Build environment to compile khanat server # # Copyright (C) 2017 AleaJactaEst # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Affero General Public License for more details. # # You should have received a copy of the GNU Affero General Public License # along with this program. If not, see . # # to build : # $ docker build . -t builder_khanat_jessie_x86_64 --file dist/docker/builder/debian-8-amd64/Dockerfile # to use this image : # (on root) # $ docker run -it --hostname=builder -v $PWD/dist:/opt/dist -v $PWD/code:/opt/code builder_khanat_jessie_x86_64 /bin/bash # (with your account) # $ docker run -it --hostname=builder -u "$(id -u $USERNAME):$(id -g $USERNAME)" -v $PWD/dist:/opt/dist -v $PWD/code:/opt/code builder_khanat_jessie_x86_64 /bin/bash FROM amd64/debian:9 MAINTAINER AleaJactaEst ENV HOSTNAME builder RUN apt-get update ; \ apt-get dist-upgrade -y; \ DEBIAN_FRONTEND=noninteractive apt-get install -y apache2 apache2-utils autoconf autogen automake bison build-essential cmake cpputest default-libmysqlclient-dev fakeroot git libapache2-mod-php libboost-all-dev libfreetype6-dev libgif-dev libgl1-mesa-dev libjpeg62-turbo-dev liblua5.2-0 liblua5.2-dev liblzma-dev libogg-dev libopenal-dev libpng-dev libssh2-1-dev libssl-dev libtool libtool-bin libvorbis-dev libx11-dev libxml2-dev libxmu-dev libxrandr-dev libxrender-dev libxxf86vm-dev mercurial mysql-server php php-gd php-imagick php-mysql python3 python3-pip python3-bcrypt python3-venv rrdtool unzip wget zlib1g-dev python3-coverage python3-pep8 ## Build & Install cpptest # Impossible to build release 1.1.0, 1.1.1, 1.1.2 RUN mkdir -p /opt/src/cpptest RUN wget -q https://github.com/cpptest/cpptest/archive/1.0.5.tar.gz -O /opt/src/cpptest.tar.gz || exit 2 RUN tar xf /opt/src/cpptest.tar.gz -C /opt/src --strip 1 || exit 2 RUN cd /opt/src/cpptest && ./autogen.sh && ./configure && make && make install || exit 2 # Build debug & install (cpptestd) RUN cd /opt/src/cpptest && make clean && CXXFLAGS="-g -O0" ./configure && make && for file in src/.libs/lib*.so* src/.libs/lib*.a;do extension=${file##*/libcpptest} ; cp -L $file /usr/local/lib/libcpptestd${extension}; done ## Build & Install squish RUN mkdir -p /opt/src RUN cd /opt/src; wget -c https://storage.googleapis.com/google-code-archive-downloads/v2/code.google.com/libsquish/squish-1.11.zip RUN cd /opt/src; unzip squish-1.11.zip COPY common/squish-limit.patch /opt/squish-limit.patch RUN cd /opt/src/squish-1.11; patch -i /opt/squish-limit.patch || exit 2 RUN cd /opt/src/squish-1.11; make || exit 2 RUN cd /opt/src/squish-1.11; make install || exit 2 ## Build & Install CURL - 7.58.0 RUN wget -q https://curl.haxx.se/download/curl-7.58.0.tar.gz -O /opt/src/curl.tar.gz RUN mkdir -p /opt/src/curl/build RUN tar xf /opt/src/curl.tar.gz -C /opt/src/curl --strip 1 || exit 2 RUN cd /opt/src/curl/build; cmake -DCMAKE_BUILD_TYPE=Release -DCURL_ZLIB=ON -DBUILD_CURL_EXE=OFF -DCURL_STATICLIB=ON -DHTTP_ONLY=ON -DENABLE_IPV6=ON -DCMAKE_USE_OPENSSL=ON -DOPENSSL_SSL_LIBRARIES=/usr/lib/x86_64-linux-gnu/libssl.a -DOPENSSL_CRYPTO_LIBRARIES=/usr/lib/x86_64-linux-gnu/libcrypto.a -DCMAKE_USE_LIBSSH2=OFF -DZLIB_LIBRARY=/usr/lib/x86_64-linux-gnu/libz.a -DCMAKE_C_FLAGS='-fPIC' .. || exit 2 RUN cd /opt/src/curl/build; make || exit 2 RUN cd /opt/src/curl/build; make install || exit 2 ## Build & Install luabind RUN mkdir -p /opt/src/luabind RUN wget -q http://http.debian.net/debian/pool/main/l/luabind/luabind_0.9.1+dfsg.orig.tar.gz -O /opt/src/luabind.tar.gz RUN wget -q http://http.debian.net/debian/pool/main/l/luabind/luabind_0.9.1+dfsg-11.debian.tar.xz -O /opt/src/luabind-debian.tar.xz RUN tar xf /opt/src/luabind.tar.gz -C /opt/src/luabind --strip 1 || exit 2 RUN tar xf /opt/src/luabind-debian.tar.xz -C /opt/src/luabind || exit 2 RUN cd /opt/src/luabind; for file in $(cat debian/patches/series); do patch -p1 < debian/patches/$file || exit 2; done RUN cd /opt/src/luabind; DEB_HOST_MULTIARCH=$(dpkg-architecture -qDEB_HOST_MULTIARCH) bjam -d2 release debug install cflags="-fPIC $(dpkg-buildflags --get CFLAGS)" cxxflags="-fPIC $(dpkg-buildflags --get CXXFLAGS) -Wno-deprecated-declarations" linkflags=" $(dpkg-buildflags --get LDFLAGS)" RUN cd /opt/src/luabind; DEB_HOST_MULTIARCH=$(dpkg-architecture -qDEB_HOST_MULTIARCH) bjam -d2 release debug install link=static cflags="-fPIC $(dpkg-buildflags --get CFLAGS)" cxxflags="-fPIC $(dpkg-buildflags --get CXXFLAGS) -Wno-deprecated-declarations" linkflags=" $(dpkg-buildflags --get LDFLAGS)" # Build libogg RUN mkdir -p /opt/src/libogg/build RUN wget -q http://http.debian.net/debian/pool/main/libo/libogg/libogg_1.3.2.orig.tar.gz -O /opt/src/libogg.tar.gz RUN wget -q http://http.debian.net/debian/pool/main/libo/libogg/libogg_1.3.2-1.diff.gz -O /opt/src/libogg.diff.gz RUN tar xvf /opt/src/libogg.tar.gz -C /opt/src/libogg --strip 1 || exit 2 RUN gunzip /opt/src/libogg.diff.gz RUN cd /opt/src/libogg/; patch -p1 < /opt/src/libogg.diff RUN cd /opt/src/libogg/build; /opt/src/libogg/configure --disable-maintainer-mode --host=$(dpkg-architecture -qDEB_HOST_GNU_TYPE) --build=$(dpkg-architecture -qDEB_BUILD_GNU_TYPE) --libdir=/usr/lib/$(dpkg-architecture -qDEB_HOST_MULTIARCH) --enable-static --prefix=/usr CPPFLAGS="-D_FORTIFY_SOURCE=2" CFLAGS="-Wformat=2 -g -fPIC" CXXFLAGS="-Wformat=2 -g -fPIC" LDFLAGS="-Wl,-z,now" RUN cd /opt/src/libogg/build; make RUN cd /opt/src/libogg/build; make install # Build libvorbis RUN mkdir -p /opt/src/libvorbis RUN wget -q http://security.debian.org/debian-security/pool/updates/main/libv/libvorbis/libvorbis_1.3.5.orig.tar.gz -O /opt/src/libvorbis.tar.gz RUN tar xvf /opt/src/libvorbis.tar.gz -C /opt/src/libvorbis --strip 1 || exit 2 RUN wget -q http://security.debian.org/debian-security/pool/updates/main/libv/libvorbis -O /opt/src/libvorbis/list_libvorbis RUN line=$(egrep '(libvorbis_1.3.5)(.*)(tar[.]xz)' /opt/src/libvorbis/list_libvorbis | tail -n 1) ; tmp=${line#*href} ; tmp2=${tmp%%>*} ; tmp3=${tmp2#*\"} ; namepatch=${tmp3%\"*} ; wget -q http://security.debian.org/debian-security/pool/updates/main/libv/libvorbis/$namepatch -O /opt/src/libvorbis/libvorbis.debian.tar.xz RUN tar xvf /opt/src/libvorbis/libvorbis.debian.tar.xz -C /opt/src/libvorbis || exit 2 RUN cd /opt/src/libvorbis/; for file in $(cat debian/patches/series); do patch -p1 < debian/patches/$file || exit 2; done RUN cd /opt/src/libvorbis/; ./configure --enable-static --with-pic RUN cd /opt/src/libvorbis/; make RUN cd /opt/src/libvorbis/; make install # Create directory RUN mkdir -p /opt/ref ; chmod 777 /opt/ref RUN ldconfig