Skip to content

Commit 189b04b

Browse files
committed
Use a custom base Docker image for proxy images
instead of using ficusio/openresty:1.7.7.1, which is based on another image (alpinelinux/base) that no longer seems to exist on Docker Hub. This will also give us more control with how we're configuring Nginx/Openresty.
1 parent f407caf commit 189b04b

File tree

6 files changed

+73
-4
lines changed

6 files changed

+73
-4
lines changed

hosts/proxy/Dockerfile

+60
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
FROM ubuntu:14.04.2
2+
3+
RUN apt-get update \
4+
&& apt-get install -y --no-install-recommends \
5+
curl perl make build-essential procps \
6+
libreadline-dev libncurses5-dev libpcre3-dev libssl-dev \
7+
&& rm -rf /var/lib/apt/lists/*
8+
9+
ENV OPENRESTY_VERSION 1.7.7.1
10+
ENV OPENRESTY_PREFIX /opt/openresty
11+
ENV NGINX_PREFIX /opt/openresty/nginx
12+
ENV VAR_PREFIX /var/nginx
13+
14+
# NginX prefix is automatically set by OpenResty to $OPENRESTY_PREFIX/nginx
15+
# look for $ngx_prefix in https://github.com/openresty/ngx_openresty/blob/master/util/configure
16+
17+
RUN cd /root \
18+
&& echo "==> Downloading OpenResty..." \
19+
&& curl -sSL http://openresty.org/download/ngx_openresty-${OPENRESTY_VERSION}.tar.gz | tar -xvz \
20+
&& echo "==> Configuring OpenResty..." \
21+
&& cd ngx_openresty-* \
22+
&& readonly NPROC=$(grep -c ^processor /proc/cpuinfo 2>/dev/null || 1) \
23+
&& echo "using upto $NPROC threads" \
24+
&& ./configure \
25+
--prefix=$OPENRESTY_PREFIX \
26+
--http-client-body-temp-path=$VAR_PREFIX/client_body_temp \
27+
--http-proxy-temp-path=$VAR_PREFIX/proxy_temp \
28+
--http-log-path=$VAR_PREFIX/access.log \
29+
--error-log-path=$VAR_PREFIX/error.log \
30+
--pid-path=$VAR_PREFIX/nginx.pid \
31+
--lock-path=$VAR_PREFIX/nginx.lock \
32+
--with-luajit \
33+
--with-pcre-jit \
34+
--with-ipv6 \
35+
--with-http_ssl_module \
36+
--without-http_ssi_module \
37+
--without-http_userid_module \
38+
--without-http_fastcgi_module \
39+
--without-http_uwsgi_module \
40+
--without-http_scgi_module \
41+
--without-http_memcached_module \
42+
-j${NPROC} \
43+
&& echo "==> Building OpenResty..." \
44+
&& make -j${NPROC} \
45+
&& echo "==> Installing OpenResty..." \
46+
&& make install \
47+
&& echo "==> Finishing..." \
48+
&& ln -sf $NGINX_PREFIX/sbin/nginx /usr/local/bin/nginx \
49+
&& ln -sf $NGINX_PREFIX/sbin/nginx /usr/local/bin/openresty \
50+
&& ln -sf $OPENRESTY_PREFIX/bin/resty /usr/local/bin/resty \
51+
&& ln -sf $OPENRESTY_PREFIX/luajit/bin/luajit-* $OPENRESTY_PREFIX/luajit/bin/lua \
52+
&& ln -sf $OPENRESTY_PREFIX/luajit/bin/luajit-* /usr/local/bin/lua \
53+
&& rm -rf /root/ngx_openresty*
54+
55+
WORKDIR $NGINX_PREFIX/
56+
57+
ONBUILD RUN rm -rf conf/* html/*
58+
ONBUILD COPY nginx $NGINX_PREFIX/
59+
60+
CMD ["nginx", "-g", "daemon off; error_log /dev/stderr info;"]

hosts/proxy/base64-secret/Dockerfile

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM ficusio/openresty:1.7.7.1
1+
FROM proxy-base-image
22

33
# secret is base-64 encoded and URL-safe
44
ENV JWT_SECRET="VGhpcyBzZWNyZXQgaXMgc3RvcmVkIGJhc2UtNjQgZW5jb2RlZCBvbiB0aGUgcHJveHkgaG9zdA"

hosts/proxy/config-claim_specs-not-table/Dockerfile

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM ficusio/openresty:1.7.7.1
1+
FROM proxy-base-image
22

33
ENV JWT_SECRET="JWTs are the best!"
44

hosts/proxy/config-unsupported-claim-spec-type/Dockerfile

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM ficusio/openresty:1.7.7.1
1+
FROM proxy-base-image
22

33
ENV JWT_SECRET="JWTs are the best!"
44

hosts/proxy/default/Dockerfile

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM ficusio/openresty:1.7.7.1
1+
FROM proxy-base-image
22

33
ENV JWT_SECRET="JWTs are the best!"
44

run.sh

+9
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,15 @@ load_dependency "lib/basexx.lua" "aiq" "basexx" "c91cf5438385d9f84f53d3ef27f855c
3535

3636
# build proxy containers and images
3737

38+
echo "${cyan}Building base proxy image, if necessary...${NC}"
39+
image_exists=$(docker images | grep "proxy-base-image") || true
40+
if [ -z "$image_exists" ]; then
41+
echo "${blue}Building image${no_color}"
42+
docker build -t="proxy-base-image" --force-rm hosts/proxy
43+
else
44+
echo "${blue}Base image already exists${no_color}"
45+
fi
46+
3847
for proxy_dir in hosts/proxy/*; do
3948
[ -d "${proxy_dir}" ] || continue # if not a directory, skip
4049

0 commit comments

Comments
 (0)