Skip to content

Commit

Permalink
Merge pull request #7 from signalsciences/lisa/28052-update-dockerfil…
Browse files Browse the repository at this point in the history
…e-from-statement

Updated dockerfile to pull from k8s.gcr.io
  • Loading branch information
lsmith500 authored Jan 21, 2021
2 parents 10a8f82 + 7b4ddda commit 7c1812b
Showing 1 changed file with 8 additions and 10 deletions.
18 changes: 8 additions & 10 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
ARG NGINX_INGRESS_VERSION=${NGINX_INGRESS_VERSION:-0.30.0}
FROM quay.io/kubernetes-ingress-controller/nginx-ingress-controller:${NGINX_INGRESS_VERSION}
ARG NGINX_INGRESS_VERSION=${NGINX_INGRESS_VERSION:-v0.43.0}
FROM k8s.gcr.io/ingress-nginx/controller:${NGINX_INGRESS_VERSION}
ARG PKGNAME=${PKGNAME:-nginx-module-sigsci-nxo}

# Change to the root user to update the container
Expand All @@ -11,22 +11,20 @@ USER root
# to both nginx.org and openresty nginx distributions.
RUN apk update && apk add --no-cache gnupg wget --virtual ./build_deps \
# Figure out which alpine release this is
&& ALPINE_RELEASE=$(cat /etc/alpine-release | sed 's/\./\_/g') \
&& ALPINE_RELEASE=$(cat /etc/alpine-release) \
&& ALPINE_RELEASE=${ALPINE_RELEASE::-2} \
# Figure out which nginx is installed in the container
&& NGXVERSION=$(nginx -v 2>&1 | sed 's%^[^/]*/\([0-9]*\.[0-9]*\.[0-9]*\).*%\1%') \
# Get the latest version of the sigsci nginx native module
&& MODULE_VERSION=$(wget -O- -q https://dl.signalsciences.net/sigsci-module-nginx-native/VERSION) \
# Get the correct sigsci nginx native module based on alpine version, nginx version, and module version
&& wget -O /tmp/nginx-module-sigsci-nxo_${NGXVERSION}-alpine${ALPINE_RELEASE}.tar.gz https://dl.signalsciences.net/sigsci-module-nginx-native/${MODULE_VERSION}/alpine/alpine${ALPINE_RELEASE}/nginx-module-sigsci-nxo_${NGXVERSION}-alpine${ALPINE_RELEASE}.tar.gz \
# Manually install the sigsci native nginx module and update nginx.conf
&& tar xvfz /tmp/nginx-module-sigsci-nxo_${NGXVERSION}-alpine${ALPINE_RELEASE}.tar.gz -C /tmp || : \
&& mkdir -p /usr/lib/nginx/modules \
&& mv /tmp/ngx_http_sigsci_nxo_module-${NGXVERSION}.so /usr/lib/nginx/modules/ngx_http_sigsci_module.so \
&& wget https://apk.signalsciences.net/sigsci_apk.pub && mv sigsci_apk.pub /etc/apk/keys \
&& echo "https://apk.signalsciences.net/${ALPINE_RELEASE}/main" | tee -a /etc/apk/repositories \
&& apk add ${PKGNAME}-${NGXVERSION} \
&& ln -s /usr/lib/nginx/modules/ngx_http_sigsci_module.so /etc/nginx/modules/ngx_http_sigsci_module.so \
&& sed -i 's@^pid.*@&\nload_module /usr/lib/nginx/modules/ngx_http_sigsci_module.so;\n@' /etc/nginx/nginx.conf \
# cleanup
&& rm /tmp/nginx-module-sigsci-nxo_${NGXVERSION}-alpine${ALPINE_RELEASE}.tar.gz /tmp/*.so \
&& apk del --no-cache ./build_deps
&& apk del --no-cache ./build_deps \
&& rm /etc/apk/keys/sigsci_apk.pub
# Change back to the www-data user for executing nginx at runtime
USER www-data

0 comments on commit 7c1812b

Please sign in to comment.