github.com/wasbazi/deis@v1.7.1-0.20150609203025-5765871615de/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.9.0
    14  export VERSION_NAXSI=0d53a64ed856e694fcb4038748c8cf6d5551a603
    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  apk add --update-cache \
    29    build-base \
    30    curl \
    31    geoip-dev \
    32    libcrypto1.0 \
    33    libpcre32 \
    34    patch \
    35    pcre-dev \
    36    openssl-dev \
    37    zlib \
    38    zlib-dev
    39  
    40  # grab the source files
    41  curl -sSL http://nginx.org/download/$VERSION_NGINX.tar.gz -o $BUILD_PATH/$VERSION_NGINX.tar.gz
    42  curl -sSL https://github.com/nbs-system/naxsi/archive/$VERSION_NAXSI.tar.gz -o $BUILD_PATH/$VERSION_NAXSI.tar.gz
    43  
    44  # expand the source files
    45  tar xzf $VERSION_NGINX.tar.gz
    46  tar xzf $VERSION_NAXSI.tar.gz
    47  
    48  # build nginx
    49  cd $BUILD_PATH/$VERSION_NGINX
    50  
    51  ./configure \
    52    --prefix=$PREFIX \
    53    --pid-path=/run/nginx.pid \
    54    --with-debug \
    55    --with-pcre-jit \
    56    --with-ipv6 \
    57    --with-http_ssl_module \
    58    --with-http_stub_status_module \
    59    --with-http_realip_module \
    60    --with-http_auth_request_module \
    61    --with-http_addition_module \
    62    --with-http_dav_module \
    63    --with-http_geoip_module \
    64    --with-http_gzip_static_module \
    65    --with-http_spdy_module \
    66    --with-http_sub_module \
    67    --with-mail \
    68    --with-mail_ssl_module \
    69    --with-stream \
    70    --add-module=$BUILD_PATH/naxsi-$VERSION_NAXSI/naxsi_src \
    71    && make && make install
    72  
    73  mv /tmp/firewall /opt/nginx/firewall