|
1 | | -FROM ubuntu:16.04 |
| 1 | +## this docker file is based on a relatively old setup so that libc dependencies |
| 2 | +## should not be a problem. It: |
| 3 | +# 1. builds htslib and all dependencies currently without libcurl |
| 4 | +# 2. installs nim |
| 5 | +# 3. sets up a nim binary (nsb) that is expected to be called from an external binary (static_builder) |
| 6 | +# These facilitate building static binaries for projects using hts-nim. |
2 | 7 |
|
3 | | -RUN apt-get update \ |
4 | | - && apt-get -qy install curl libssl-dev build-essential gcc \ |
5 | | - && curl -sSfLo init.sh https://nim-lang.org/choosenim/init.sh \ |
6 | | - && bash init.sh -y \ |
7 | | - && rm init.sh \ |
8 | | - && echo "export PATH=/root/.nimble/bin:$PATH" >> /etc/profile \ |
9 | | - && echo "export PATH=/root/.nimble/bin:$PATH" >> /etc/bash.bashrc \ |
| 8 | +# docker build -t brentp/hts-nim:latest -f Dockerfile . |
| 9 | +FROM centos:centos6 |
10 | 10 |
|
| 11 | +RUN yum install -y git curl wget zlib-devel xz-devel bzip2-devel libcurl-devel && \ |
| 12 | + wget http://people.centos.org/tru/devtools-2/devtools-2.repo -O /etc/yum.repos.d/devtools-2.repo && \ |
| 13 | + yum install -y devtoolset-2-gcc devtoolset-2-binutils devtoolset-2-gcc-c++ lzma-devel glibc-static && \ |
| 14 | + source scl_source enable devtoolset-2 && \ |
| 15 | + echo "source scl_source enable devtoolset-2" >> ~/.bashrc && \ |
| 16 | + echo "source scl_source enable devtoolset-2" >> ~/.bash_profile && \ |
| 17 | + wget --quiet https://ftp.gnu.org/gnu/m4/m4-1.4.18.tar.gz && \ |
| 18 | + tar xzf m4-1.4.18.tar.gz && cd m4* && ./configure && make && make install && cd .. && \ |
| 19 | + rm -rf m4* && \ |
| 20 | + wget --quiet http://ftp.gnu.org/gnu/autoconf/autoconf-2.69.tar.gz && \ |
| 21 | + tar xzf autoconf-2.69.tar.gz && \ |
| 22 | + cd autoconf* && ./configure && make && make install && cd .. && rm -rf autoconf* && \ |
| 23 | + git clone --depth 1 https://github.com/ebiggers/libdeflate.git && \ |
| 24 | + cd libdeflate && make -j 2 CFLAGS='-fPIC -O3' libdeflate.a && \ |
| 25 | + cp libdeflate.a /usr/local/lib && cp libdeflate.h /usr/local/include && \ |
| 26 | + cd .. && rm -rf libdeflate && \ |
| 27 | + wget --quiet http://http.debian.net/debian/pool/main/b/bzip2/bzip2_1.0.6.orig.tar.bz2 && \ |
| 28 | + tar xjvf bzip2_1.0.6.orig.tar.bz2 && \ |
| 29 | + cd bzip2-1.0.6 && \ |
| 30 | + make -j2 install && \ |
| 31 | + cd ../ && \ |
| 32 | + rm -rf bzip2-* && \ |
| 33 | + wget --quiet https://www.zlib.net/zlib-1.2.11.tar.gz && \ |
| 34 | + tar xzf zlib-1.2.11.tar.gz && \ |
| 35 | + cd zlib-1.2.11 && \ |
| 36 | + ./configure && \ |
| 37 | + make -j4 install && \ |
| 38 | + cd .. && \ |
| 39 | + rm -rf zlib* && \ |
| 40 | + wget --quiet https://tukaani.org/xz/xz-5.2.4.tar.bz2 && \ |
| 41 | + tar xjf xz-5.2.4.tar.bz2 && \ |
| 42 | + cd xz-5.2.4 && \ |
| 43 | + ./configure && \ |
| 44 | + make -j4 install && \ |
| 45 | + cd .. && \ |
| 46 | + rm -r xz* |
11 | 47 |
|
| 48 | + |
| 49 | +RUN source scl_source enable devtoolset-2 && \ |
| 50 | + cd / && \ |
| 51 | + wget --quiet http://www.musl-libc.org/releases/musl-1.1.21.tar.gz && \ |
| 52 | + tar xvf musl-1.1.21.tar.gz && \ |
| 53 | + cd musl-1.1.21 && \ |
| 54 | + ./configure && \ |
| 55 | + make -j4 install && \ |
| 56 | + rm -rf musl-* |
| 57 | + |
| 58 | + |
| 59 | +RUN source scl_source enable devtoolset-2 && \ |
| 60 | + cd / && \ |
| 61 | + wget --quiet https://www.openssl.org/source/openssl-1.1.1b.tar.gz && \ |
| 62 | + tar xzvf openssl-1.1.1b.tar.gz && \ |
| 63 | + cd openssl-1.1.1b && \ |
| 64 | + ./config && \ |
| 65 | + make install && cd ../ && rm -rf openssl-1.1.1b |
| 66 | + |
| 67 | + |
| 68 | +RUN cd / && \ |
| 69 | + git clone -b devel --depth 10 git://github.com/nim-lang/nim nim && \ |
| 70 | + cd nim && \ |
| 71 | + chmod +x ./build_all.sh && \ |
| 72 | + scl enable devtoolset-2 ./build_all.sh && \ |
| 73 | + echo 'PATH=/nim/bin:$PATH' >> ~/.bashrc && \ |
| 74 | + echo 'PATH=/nim/bin:$PATH' >> ~/.bash_profile && \ |
| 75 | + echo 'PATH=/nim/bin:$PATH' >> /etc/environment |
| 76 | + |
| 77 | +RUN source scl_source enable devtoolset-2 && \ |
| 78 | + wget --quiet https://c-ares.haxx.se/download/c-ares-1.15.0.tar.gz && \ |
| 79 | + tar xzf c-ares-1.15.0.tar.gz && \ |
| 80 | + cd c-ares-1.15.0 && \ |
| 81 | + LIBS="-lrt" LDFLAGS="-Wl,--no-as-needed -static" ./configure --enable-static && \ |
| 82 | + make LDFLAGS="-Wl,--no-as-needed -all-static -lrt -lssl -lcrypto -lc" -j4 install && \ |
| 83 | + cd .. && \ |
| 84 | + rm -rf c-ares-1.15.0* && \ |
| 85 | + wget --quiet https://curl.haxx.se/download/curl-7.64.0.tar.gz && \ |
| 86 | + tar xzf curl-7.64.0.tar.gz && \ |
| 87 | + cd curl-7.64.0 && \ |
| 88 | + LIBS="-ldl -lpthread -lrt -lssl -lcrypto -lcares -ldl -lc" LDFLAGS="-Wl,--no-as-needed -static" PKG_CONFIG="pkg-config --static" ./configure --disable-shared --enable-static --disable-ldap --with-ssl=/usr/local/ --disable-sspi --without-librtmp --disable-ftp --disable-file --disable-dict --disable-telnet --disable-tftp --disable-rtsp --disable-pop3 --disable-imap --disable-smtp --disable-gopher --disable-smb --without-libidn --enable-ares && \ |
| 89 | + make curl_LDFLAGS=-all-static LDFLAGS="-Wl,--no-as-needed -all-static -lrt -lssl -lcrypto -lcares -ldl -lc" -j4 install && \ |
| 90 | + cd ../ && \ |
| 91 | + rm -rf curl-7.64.0* |
| 92 | + |
| 93 | + |
| 94 | +RUN source scl_source enable devtoolset-2 && \ |
| 95 | + git clone https://github.com/samtools/htslib && \ |
| 96 | + cd htslib && git checkout 1.9 && autoheader && autoconf && \ |
| 97 | + ./configure --enable-s3 --enable-libcurl --with-libdeflate && \ |
| 98 | + make LDFLAGS="-Wl,--no-as-needed -lrt -lssl -lcrypto -ldl -lcares -lc" -j4 CFLAGS="-fPIC -O3 -lcrypto" install && \ |
| 99 | + echo "/usr/local/lib" >> /etc/ld.so.conf && \ |
| 100 | + ldconfig && \ |
| 101 | + cd ../ && rm -rf htslib |
| 102 | + |
| 103 | + |
| 104 | +ENV PATH=:/root/.nimble/bin:/nim/bin/:$PATH:/opt/rh/devtoolset-2/root/usr/bin/ |
| 105 | + |
| 106 | +ADD . /src/ |
| 107 | +RUN cat /src/docker/docker.nim.cfg >> /nim/config/nim.cfg && \ |
| 108 | + echo "source scl_source enable devtoolset-2" >> /etc/environment && \ |
| 109 | + source ~/.bashrc && cd /src/ && nimble install -y && \ |
| 110 | + nimble install -y docopt && \ |
| 111 | + nimble install -y c2nim@#3ec45c24585ebaed && \ |
| 112 | + nim c -o:/usr/local/bin/nsb /src/docker/nsb.nim && \ |
| 113 | + rm -rf /src/ |
0 commit comments