Skip to content

Commit 0dafb34

Browse files
authored
Change the base image to Debian Stretch for Plus controller (#235)
1 parent 5a4b11c commit 0dafb34

File tree

1 file changed

+37
-19
lines changed

1 file changed

+37
-19
lines changed

nginx-controller/DockerfileForPlus

Lines changed: 37 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,43 +1,61 @@
1-
FROM ubuntu:16.04
1+
FROM debian:stretch-slim
22

3-
MAINTAINER NGINX Docker Maintainers "[email protected]"
3+
LABEL maintainer="NGINX Docker Maintainers <[email protected]>"
44

5-
# Set the debconf front end to Noninteractive
6-
RUN echo 'debconf debconf/frontend select Noninteractive' | debconf-set-selections
7-
8-
RUN apt-get update && apt-get install -y -q wget lsb-release apt-transport-https
5+
ENV NGINX_PLUS_VERSION 1.13.7-2~stretch
96

107
# Download certificate and key from the customer portal (https://cs.nginx.com)
118
# and copy to the build context
12-
ADD nginx-repo.crt /etc/ssl/nginx/
13-
ADD nginx-repo.key /etc/ssl/nginx/
9+
COPY nginx-repo.crt /etc/ssl/nginx/
10+
COPY nginx-repo.key /etc/ssl/nginx/
1411

1512
# Make sure the certificate and key have correct permissions
1613
RUN chmod 644 /etc/ssl/nginx/*
1714

18-
# Get other files required for installation
19-
RUN wget -q -O - http://nginx.org/keys/nginx_signing.key | apt-key add -
20-
RUN wget -q -O /etc/apt/apt.conf.d/90nginx https://cs.nginx.com/static/files/90nginx
21-
22-
RUN printf "deb https://plus-pkgs.nginx.com/ubuntu `lsb_release -cs` nginx-plus\n" >/etc/apt/sources.list.d/nginx-plus.list
23-
2415
# Install NGINX Plus
25-
RUN apt-get update && apt-get install -y nginx-plus
16+
RUN set -x \
17+
&& apt-get update && apt-get upgrade -y \
18+
&& apt-get install --no-install-recommends --no-install-suggests -y apt-transport-https ca-certificates gnupg1 \
19+
&& \
20+
NGINX_GPGKEY=573BFD6B3D8FBC641079A6ABABF5BD827BD9BF62; \
21+
found=''; \
22+
for server in \
23+
ha.pool.sks-keyservers.net \
24+
hkp://keyserver.ubuntu.com:80 \
25+
hkp://p80.pool.sks-keyservers.net:80 \
26+
pgp.mit.edu \
27+
; do \
28+
echo "Fetching GPG key $NGINX_GPGKEY from $server"; \
29+
apt-key adv --keyserver "$server" --keyserver-options timeout=10 --recv-keys "$NGINX_GPGKEY" && found=yes && break; \
30+
done; \
31+
test -z "$found" && echo >&2 "error: failed to fetch GPG key $NGINX_GPGKEY" && exit 1; \
32+
echo "Acquire::https::plus-pkgs.nginx.com::Verify-Peer \"true\";" >> /etc/apt/apt.conf.d/90nginx \
33+
&& echo "Acquire::https::plus-pkgs.nginx.com::Verify-Host \"true\";" >> /etc/apt/apt.conf.d/90nginx \
34+
&& echo "Acquire::https::plus-pkgs.nginx.com::SslCert \"/etc/ssl/nginx/nginx-repo.crt\";" >> /etc/apt/apt.conf.d/90nginx \
35+
&& echo "Acquire::https::plus-pkgs.nginx.com::SslKey \"/etc/ssl/nginx/nginx-repo.key\";" >> /etc/apt/apt.conf.d/90nginx \
36+
&& printf "deb https://plus-pkgs.nginx.com/debian stretch nginx-plus\n" > /etc/apt/sources.list.d/nginx-plus.list \
37+
&& apt-get update && apt-get install -y nginx-plus=${NGINX_PLUS_VERSION} \
38+
&& apt-get remove --purge --auto-remove -y gnupg1 \
39+
&& rm -rf /var/lib/apt/lists/* \
40+
&& rm -rf /etc/ssl/nginx \
41+
&& rm /etc/apt/apt.conf.d/90nginx /etc/apt/sources.list.d/nginx-plus.list
2642

27-
EXPOSE 80 443 8080
2843

2944
# forward nginx access and error logs to stdout and stderr of the ingress
3045
# controller process
3146
RUN ln -sf /proc/1/fd/1 /var/log/nginx/access.log \
3247
&& ln -sf /proc/1/fd/2 /var/log/nginx/error.log
3348

49+
50+
EXPOSE 80 443
51+
3452
COPY nginx-ingress nginx/templates/nginx-plus.ingress.tmpl nginx/templates/nginx-plus.tmpl /
35-
RUN rm /etc/nginx/conf.d/*
3653

37-
RUN mkdir -p /etc/nginx/secrets
54+
RUN rm /etc/nginx/conf.d/* \
55+
&& mkdir -p /etc/nginx/secrets
3856

3957
# Uncomment the line below if you would like to add the default.pem to the image
4058
# and use it as a certificate and key for the default server
4159
# ADD default.pem /etc/nginx/secrets/default
4260

43-
ENTRYPOINT ["/nginx-ingress"]
61+
ENTRYPOINT ["/nginx-ingress"]

0 commit comments

Comments
 (0)