github.com/rvaralda/deis@v1.4.1/router/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  export VERSION_NAXSI=0d53a64ed856e694fcb4038748c8cf6d5551a603
    16  
    17  export BUILD_PATH=/tmp/build
    18  
    19  # nginx installation directory
    20  export PREFIX=/opt/nginx
    21  
    22  rm -rf $PREFIX
    23  mkdir $PREFIX
    24  
    25  mkdir $BUILD_PATH
    26  cd $BUILD_PATH
    27  
    28  # install required packages to build
    29  apt-get update \
    30    && apt-get install -y patch curl build-essential \
    31    libpcre3 libpcre3-dev libssl-dev libgeoip-dev zlib1g-dev
    32  
    33  # grab the source files
    34  curl -sSL http://nginx.org/download/$VERSION_NGINX.tar.gz -o $BUILD_PATH/$VERSION_NGINX.tar.gz
    35  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
    36  curl -sSL https://github.com/nbs-system/naxsi/archive/$VERSION_NAXSI.tar.gz -o $BUILD_PATH/$VERSION_NAXSI.tar.gz
    37  
    38  # expand the source files
    39  tar xzf $VERSION_NGINX.tar.gz
    40  tar xzf $VERSION_TCP_PROXY.tar.gz
    41  tar xzf $VERSION_NAXSI.tar.gz
    42  
    43  # build nginx
    44  cd $BUILD_PATH/$VERSION_NGINX
    45  
    46  patch -p1 < $BUILD_PATH/nginx_tcp_proxy_module-$VERSION_TCP_PROXY/tcp.patch
    47  
    48  ./configure \
    49    --prefix=$PREFIX \
    50    --pid-path=/run/nginx.pid \
    51    --with-debug \
    52    --with-pcre-jit \
    53    --with-ipv6 \
    54    --with-http_ssl_module \
    55    --with-http_stub_status_module \
    56    --with-http_realip_module \
    57    --with-http_auth_request_module \
    58    --with-http_addition_module \
    59    --with-http_dav_module \
    60    --with-http_geoip_module \
    61    --with-http_gzip_static_module \
    62    --with-http_spdy_module \
    63    --with-http_sub_module \
    64    --with-mail \
    65    --with-mail_ssl_module \
    66    --add-module=$BUILD_PATH/nginx_tcp_proxy_module-$VERSION_TCP_PROXY \
    67    --add-module=$BUILD_PATH/naxsi-$VERSION_NAXSI/naxsi_src \
    68    && make && make install
    69    
    70  mv /tmp/firewall /opt/nginx/firewall