github.com/epicpaas/deis@v1.0.2-0.20141114233758-6bbccb748f60/router/parent/build.sh (about)

     1  #!/usr/bin/env bash
     2  
     3  # fail on any command exiting non-zero
     4  set -eo pipefail
     5  
     6  if [[ -z $DOCKER_BUILD ]]; then
     7    echo
     8    echo "Note: this script is intended for use by the Dockerfile and not as a way to build the router locally"
     9    echo
    10    exit 1
    11  fi
    12  
    13  export VERSION_NGINX=nginx-1.6.2
    14  export VERSION_TCP_PROXY=0.4.5
    15  
    16  export BUILD_PATH=/tmp/build
    17  
    18  # nginx installation directory
    19  export PREFIX=/opt/nginx
    20  
    21  rm -rf $PREFIX
    22  mkdir $PREFIX
    23  
    24  mkdir $BUILD_PATH
    25  cd $BUILD_PATH
    26  
    27  # install required packages to build
    28  apt-get update \
    29    && apt-get install -y patch curl build-essential \
    30    libpcre3 libpcre3-dev libssl-dev libgeoip-dev zlib1g-dev
    31  
    32  # grab the source files
    33  curl -sSL http://nginx.org/download/$VERSION_NGINX.tar.gz -o $BUILD_PATH/$VERSION_NGINX.tar.gz
    34  curl -sSL https://github.com/yaoweibin/nginx_tcp_proxy_module/archive/v$VERSION_TCP_PROXY.tar.gz -o $BUILD_PATH/$VERSION_TCP_PROXY.tar.gz
    35  
    36  # expand the source files
    37  tar xzf $VERSION_NGINX.tar.gz
    38  tar xzf $VERSION_TCP_PROXY.tar.gz
    39  
    40  # build nginx
    41  cd $BUILD_PATH/$VERSION_NGINX
    42  
    43  patch -p1 < $BUILD_PATH/nginx_tcp_proxy_module-$VERSION_TCP_PROXY/tcp.patch
    44  
    45  ./configure \
    46    --prefix=$PREFIX \
    47    --pid-path=/run/nginx.pid \
    48    --with-debug \
    49    --with-pcre-jit \
    50    --with-ipv6 \
    51    --with-http_ssl_module \
    52    --with-http_stub_status_module \
    53    --with-http_realip_module \
    54    --with-http_auth_request_module \
    55    --with-http_addition_module \
    56    --with-http_dav_module \
    57    --with-http_geoip_module \
    58    --with-http_gzip_static_module \
    59    --with-http_spdy_module \
    60    --with-http_sub_module \
    61    --with-mail \
    62    --with-mail_ssl_module \
    63    --add-module=$BUILD_PATH/nginx_tcp_proxy_module-$VERSION_TCP_PROXY \
    64    && make && make install