Improve Dockerfile

- Tell Vim this is a Dockerfile to enable syntax highlight;
- Explicity use Ubuntu "Trusty";
- Remove downloaded file to save space;
- Chain up some RUN commands to generate fewer layers.
This commit is contained in:
Zhuoyun Wei 2015-03-31 14:21:56 +08:00
parent 3b24be3bcd
commit 5e84f767f0
1 changed files with 17 additions and 11 deletions

View File

@ -1,3 +1,4 @@
# vim: ft=dockerfile:
# Dockerfile to build nghttp2 android binary # Dockerfile to build nghttp2 android binary
# #
# $ sudo docker build -t nghttp2-android - < Dockerfile.android # $ sudo docker build -t nghttp2-android - < Dockerfile.android
@ -9,7 +10,7 @@
# #
# $ sudo docker run -v /path/to/dest:/out nghttp2-android cp /root/build/nghttp2/src/nghttpx /out # $ sudo docker run -v /path/to/dest:/out nghttp2-android cp /root/build/nghttp2/src/nghttpx /out
FROM ubuntu FROM ubuntu:trusty
MAINTAINER Tatsuhiro Tsujikawa MAINTAINER Tatsuhiro Tsujikawa
@ -29,9 +30,10 @@ RUN apt-get install -y make binutils autoconf automake autotools-dev libtool \
genisoimage libc6-i386 lib32stdc++6 genisoimage libc6-i386 lib32stdc++6
WORKDIR /root/build WORKDIR /root/build
RUN curl -L -O http://dl.google.com/android/ndk/android-ndk-r10c-linux-x86_64.bin RUN curl -L -O http://dl.google.com/android/ndk/android-ndk-r10c-linux-x86_64.bin && \
RUN chmod a+x android-ndk-r10c-linux-x86_64.bin chmod a+x android-ndk-r10c-linux-x86_64.bin && \
RUN ./android-ndk-r10c-linux-x86_64.bin ./android-ndk-r10c-linux-x86_64.bin && \
rm android-ndk-r10c-linux-x86_64.bin
WORKDIR /root/build/android-ndk-r10c WORKDIR /root/build/android-ndk-r10c
RUN /bin/bash build/tools/make-standalone-toolchain.sh \ RUN /bin/bash build/tools/make-standalone-toolchain.sh \
@ -57,20 +59,24 @@ RUN autoreconf -i && \
make install make install
WORKDIR /root/build WORKDIR /root/build
RUN curl -L -O https://www.openssl.org/source/openssl-1.0.1j.tar.gz RUN curl -L -O https://www.openssl.org/source/openssl-1.0.1j.tar.gz && \
RUN tar xf openssl-1.0.1j.tar.gz tar xf openssl-1.0.1j.tar.gz && \
rm openssl-1.0.1j.tar.gz
WORKDIR /root/build/openssl-1.0.1j WORKDIR /root/build/openssl-1.0.1j
RUN export CROSS_COMPILE=$TOOLCHAIN/bin/arm-linux-androideabi- && \ RUN export CROSS_COMPILE=$TOOLCHAIN/bin/arm-linux-androideabi- && \
./Configure --prefix=$PREFIX android && \ ./Configure --prefix=$PREFIX android && \
make && make install_sw make && make install_sw
WORKDIR /root/build WORKDIR /root/build
RUN curl -L -O http://dist.schmorp.de/libev/libev-4.19.tar.gz RUN curl -L -O http://dist.schmorp.de/libev/libev-4.19.tar.gz && \
RUN curl -L -O https://gist.github.com/tatsuhiro-t/48c45f08950f587180ed/raw/80a8f003b5d1091eae497c5995bbaa68096e739b/libev-4.19-android.patch curl -L -O https://gist.github.com/tatsuhiro-t/48c45f08950f587180ed/raw/80a8f003b5d1091eae497c5995bbaa68096e739b/libev-4.19-android.patch && \
RUN tar xf libev-4.19.tar.gz tar xf libev-4.19.tar.gz && \
rm libev-4.19.tar.gz
WORKDIR /root/build/libev-4.19 WORKDIR /root/build/libev-4.19
RUN patch -p1 < ../libev-4.19-android.patch RUN patch -p1 < ../libev-4.19-android.patch && \
RUN ./configure \ ./configure \
--host=arm-linux-androideabi \ --host=arm-linux-androideabi \
--build=`dpkg-architecture -qDEB_BUILD_GNU_TYPE` \ --build=`dpkg-architecture -qDEB_BUILD_GNU_TYPE` \
--prefix=$PREFIX \ --prefix=$PREFIX \