forked from nginxinc/docker-nginx-controller
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
69 lines (56 loc) · 2.7 KB
/
Dockerfile
File metadata and controls
69 lines (56 loc) · 2.7 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
FROM debian:stretch-slim
LABEL maintainer="NGINX Controller Engineering"
# e.g '1234567890'
ARG API_KEY
ENV ENV_API_KEY=$API_KEY
# e.g https://<fqdn>:8443/1.4
ARG CONTROLLER_URL
ENV ENV_CONTROLLER_URL=$CONTROLLER_URL
# e.g True or False
ARG STORE_UUID=False
ENV ENV_STORE_UUID=$STORE_UUID
# e.g Instance location already defined in Controller
ARG LOCATION
ENV ENV_LOCATION=$LOCATION
# Download certificate (nginx-repo.crt) and key (nginx-repo.key) from the customer portal (https://cs.nginx.com)
# and copy to the build context
COPY nginx-repo.* /etc/ssl/nginx/
COPY nginx-plus-api.conf /etc/nginx/conf.d/
COPY ./entrypoint.sh /
# Install NGINX Plus
RUN set -ex \
&& apt-get update && apt-get upgrade -y \
&& apt-get install --no-install-recommends --no-install-suggests -y curl sudo vim procps apt-utils apt-transport-https ca-certificates gnupg1 dh-python distro-info-data libmpdec2 libpython-stdlib libpython3-stdlib \
libpython3.5-minimal libpython3.5-stdlib lsb-release python python-minimal \
python3 python3-minimal python3.5 python3.5-minimal binutils net-tools \
&& \
NGINX_GPGKEY=573BFD6B3D8FBC641079A6ABABF5BD827BD9BF62; \
found=''; \
for server in \
ha.pool.sks-keyservers.net \
hkp://keyserver.ubuntu.com:80 \
hkp://p80.pool.sks-keyservers.net:80 \
pgp.mit.edu \
; do \
echo "Fetching GPG key $NGINX_GPGKEY from $server"; \
apt-key adv --keyserver "$server" --keyserver-options timeout=10 --recv-keys "$NGINX_GPGKEY" && found=yes && break; \
done; \
test -z "$found" && echo >&2 "error: failed to fetch GPG key $NGINX_GPGKEY" && exit 1; \
echo "Acquire::https::plus-pkgs.nginx.com::Verify-Peer \"true\";" >> /etc/apt/apt.conf.d/90nginx \
&& echo "Acquire::https::plus-pkgs.nginx.com::Verify-Host \"true\";" >> /etc/apt/apt.conf.d/90nginx \
&& echo "Acquire::https::plus-pkgs.nginx.com::SslCert \"/etc/ssl/nginx/nginx-repo.crt\";" >> /etc/apt/apt.conf.d/90nginx \
&& echo "Acquire::https::plus-pkgs.nginx.com::SslKey \"/etc/ssl/nginx/nginx-repo.key\";" >> /etc/apt/apt.conf.d/90nginx \
&& printf "deb https://plus-pkgs.nginx.com/debian stretch nginx-plus\n" > /etc/apt/sources.list.d/nginx-plus.list \
# NGINX Javascript module needed for APIM
&& apt-get update && apt-get install -y nginx-plus nginx-plus-module-njs \
&& rm -rf /var/lib/apt/lists/* \
# Install Controller Agent
&& curl -k -sS -L ${CONTROLLER_URL}/install/controller/ > install.sh \
&& sed -i 's/^assume_yes=""/assume_yes="-y"/' install.sh \
&& sh ./install.sh -y
# Forward request logs to Docker log collector
RUN ln -sf /dev/stdout /var/log/nginx-controller/agent.log \
&& ln -sf /dev/stderr /var/log/nginx/error.log
EXPOSE 80
STOPSIGNAL SIGTERM
ENTRYPOINT ["sh", "/entrypoint.sh"]