Fix builds post Alpine 3.9 (#337)

diff --git a/.profiling.after b/.profiling.after
index a078925..5d5060c 100644
--- a/.profiling.after
+++ b/.profiling.after
@@ -1,6 +1,6 @@
 COPY ./api-gateway.conf.profiling /etc/api-gateway/api-gateway.conf
 RUN apt-get install -y git && mkdir -p /profiling && git clone https://github.com/openresty/stapxx.git && cd stapxx && git clone https://github.com/brendangregg/FlameGraph.git && apt-get remove -y git
-RUN apt-get install -y linux-headers-`uname -r` kbuild gcc 
+RUN apt-get install -y linux-headers-$(uname -r) kbuild gcc 
 ENV LD_LIBRARY_PATH /usr/local/lib 
 WORKDIR /tmp/stapxx
 ENTRYPOINT ["/usr/local/bin/dumb-init", "--"]
diff --git a/.profiling.before b/.profiling.before
index a17091d..9179931 100644
--- a/.profiling.before
+++ b/.profiling.before
@@ -1,6 +1,8 @@
 FROM ubuntu:latest
 
-RUN apt-get update && apt-get install -y gcc make g++ gettext git python zlib1g-dev bzip2 wget m4 git
+ENV DEBIAN_FRONTEND noninteractive
+RUN apt-get update && \
+    apt-get install -y gcc make g++ gettext git python zlib1g-dev bzip2 wget m4 git libjemalloc1 libjemalloc-dev
 WORKDIR /tmp
 RUN wget https://sourceware.org/elfutils/ftp/0.168/elfutils-0.168.tar.bz2 && tar -jxf elfutils-0.168.tar.bz2 && cd elfutils-0.168 && ./configure && make -j4 && make install
 
diff --git a/Dockerfile b/Dockerfile
index 587a61d..b87b0dd 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -21,11 +21,13 @@
 #
 # From https://hub.docker.com/_/alpine/
 #
-FROM alpine:latest
+
+FROM alpine:3.9
 
 # install dependencies
-RUN apk --update add \
-    gcc tar libtool zlib jemalloc jemalloc-dev perl tzdata \
+RUN apk update && \
+    apk add \
+    gcc tar libtool zlib perl tzdata \
     ca-certificates wget make musl-dev openssl-dev openssl pcre-dev g++ zlib-dev curl python \
     perl-test-longstring perl-list-moreutils perl-http-message geoip-dev dumb-init jq \
     && update-ca-certificates \
@@ -215,7 +217,7 @@
     && rm -rf /tmp/api-gateway
 
 RUN echo " ... installing cjose ... " \
-    && apk update && apk add automake autoconf git gcc make jansson jansson-dev \
+    && apk add automake autoconf git gcc make jansson jansson-dev \
     && mkdir -p /tmp/api-gateway \
     && curl -L -k https://github.com/cisco/cjose/archive/${CJOSE_VERSION}.tar.gz -o /tmp/api-gateway/cjose-${CJOSE_VERSION}.tar.gz \
     && tar -xf /tmp/api-gateway/cjose-${CJOSE_VERSION}.tar.gz -C /tmp/api-gateway/ \
diff --git a/build_profiling.sh b/build_profiling.sh
index 088f18d..ec9a2ac 100755
--- a/build_profiling.sh
+++ b/build_profiling.sh
@@ -32,8 +32,9 @@
 sed -i -e 's/jemalloc/libjemalloc1/g' "Dockerfile.profiling"
 sed -i -e 's/libjemalloc1-dev/libjemalloc-dev/g' "Dockerfile.profiling"
 sed -i -e 's/openssl-dev/libssl-dev/g' "Dockerfile.profiling"
+sed -i -e 's/jansson\ /libjansson4\ /g' "Dockerfile.profiling"
+sed -i -e 's/jansson-dev/libjansson-dev/g' "Dockerfile.profiling"
 sed -i -e 's/--with-debug/--with-debug\ --with-dtrace-probes/g' "Dockerfile.profiling"
-sed -i -e 's/OPENRESTY_VERSION=.*\ /OPENRESTY_VERSION=1.11.2.2\ /g' "Dockerfile.profiling"
 sed -i -e 's/adduser\ -S.*/useradd\ nginx-api-gateway/g' "Dockerfile.profiling"
 sed -i -e 's/&&\ addgroup.*//g' "Dockerfile.profiling"
 sed -i -e 's/ENTRYPOINT.*//g' "Dockerfile.profiling"