From 09af09eb1fcffb6c1819912b7a9759d1685144d4 Mon Sep 17 00:00:00 2001 From: Dean Coakley Date: Mon, 2 Dec 2019 12:11:43 +0000 Subject: [PATCH 01/21] Convert spaces in Dockerfiles to tabs --- build/DockerfileForPlus | 72 ++++++++-------- build/DockerfileWithOpentracing | 114 ++++++++++++------------- build/DockerfileWithOpentracingForPlus | 84 +++++++++--------- 3 files changed, 135 insertions(+), 135 deletions(-) diff --git a/build/DockerfileForPlus b/build/DockerfileForPlus index 5077dd5232..4f25deabb9 100644 --- a/build/DockerfileForPlus +++ b/build/DockerfileForPlus @@ -15,49 +15,49 @@ RUN chmod 644 /etc/ssl/nginx/* # Install NGINX Plus RUN set -x \ - && apt-get update \ - && apt-get install --no-install-recommends --no-install-suggests -y apt-transport-https ca-certificates gnupg1 libcap2-bin \ - && \ - 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 \ - && echo "Acquire::https::plus-pkgs.nginx.com::User-Agent \"k8s-ic-$IC_VERSION-apt\";" >> /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 \ - && apt-get update && apt-get install -y nginx-plus=${NGINX_PLUS_VERSION} \ - && setcap 'cap_net_bind_service=+ep' /usr/sbin/nginx \ - && setcap 'cap_net_bind_service=+ep' /usr/sbin/nginx-debug \ - && apt-get remove --purge --auto-remove -y gnupg1 \ - && rm -rf /var/lib/apt/lists/* \ - && rm -rf /etc/ssl/nginx \ - && rm /etc/apt/apt.conf.d/90nginx /etc/apt/sources.list.d/nginx-plus.list + && apt-get update \ + && apt-get install --no-install-recommends --no-install-suggests -y apt-transport-https ca-certificates gnupg1 libcap2-bin \ + && \ + 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 \ + && echo "Acquire::https::plus-pkgs.nginx.com::User-Agent \"k8s-ic-$IC_VERSION-apt\";" >> /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 \ + && apt-get update && apt-get install -y nginx-plus=${NGINX_PLUS_VERSION} \ + && setcap 'cap_net_bind_service=+ep' /usr/sbin/nginx \ + && setcap 'cap_net_bind_service=+ep' /usr/sbin/nginx-debug \ + && apt-get remove --purge --auto-remove -y gnupg1 \ + && rm -rf /var/lib/apt/lists/* \ + && rm -rf /etc/ssl/nginx \ + && rm /etc/apt/apt.conf.d/90nginx /etc/apt/sources.list.d/nginx-plus.list # forward nginx access and error logs to stdout and stderr of the ingress # controller process RUN ln -sf /proc/1/fd/1 /var/log/nginx/access.log \ - && ln -sf /proc/1/fd/1 /var/log/nginx/stream-access.log \ - && ln -sf /proc/1/fd/2 /var/log/nginx/error.log + && ln -sf /proc/1/fd/1 /var/log/nginx/stream-access.log \ + && ln -sf /proc/1/fd/2 /var/log/nginx/error.log RUN mkdir -p /var/lib/nginx \ - && mkdir -p /etc/nginx/secrets \ - && chown -R nginx:0 /etc/nginx \ - && chown -R nginx:0 /var/cache/nginx \ - && chown -R nginx:0 /var/lib/nginx/ \ - && apt-get remove --purge -y libcap2-bin \ - && rm /etc/nginx/conf.d/* + && mkdir -p /etc/nginx/secrets \ + && chown -R nginx:0 /etc/nginx \ + && chown -R nginx:0 /var/cache/nginx \ + && chown -R nginx:0 /var/lib/nginx/ \ + && apt-get remove --purge -y libcap2-bin \ + && rm /etc/nginx/conf.d/* EXPOSE 80 443 diff --git a/build/DockerfileWithOpentracing b/build/DockerfileWithOpentracing index 74dbaf9c86..c5171faf66 100644 --- a/build/DockerfileWithOpentracing +++ b/build/DockerfileWithOpentracing @@ -5,55 +5,55 @@ FROM nginx:${NGINX_VERSION} AS opentracing-builder ARG OPENTRACING_CPP_VERSION RUN set -x \ - && apt-get update \ - && apt-get install --no-install-recommends --no-install-suggests -y \ - libcurl4-openssl-dev \ - build-essential \ - cmake \ - git \ - ca-certificates \ - pkg-config \ - wget \ - libz-dev \ - automake \ - autogen \ - autoconf \ - libtool \ - libpcre3 \ - libpcre3-dev \ - && tempDir="$(mktemp -d)" \ - && chmod 777 "$tempDir" \ - && git clone https://github.com/opentracing-contrib/nginx-opentracing src \ - && cd "$tempDir" \ - && git clone -b v$OPENTRACING_CPP_VERSION https://github.com/opentracing/opentracing-cpp.git \ - && cd opentracing-cpp \ - && mkdir .build && cd .build \ - && cmake -DCMAKE_BUILD_TYPE=Release \ - -DBUILD_TESTING=OFF .. \ - && make && make install \ - && cd "$tempDir" \ - && NGINX_VERSION_BUILD=`nginx -v 2>&1` && NGINX_VERSION_BUILD=${NGINX_VERSION_BUILD#*nginx/} \ - && DEBIAN_VERSION="$(cat /etc/os-release | grep CODENAME | cut -f2 -d '=')" \ - && echo "deb-src http://nginx.org/packages/mainline/debian/ $DEBIAN_VERSION nginx" >> /etc/apt/sources.list \ - && apt-get update \ - && apt-get build-dep -y nginx=${NGINX_VERSION_BUILD} \ - && wget -O nginx-release-${NGINX_VERSION_BUILD}.tar.gz https://github.com/nginx/nginx/archive/release-${NGINX_VERSION_BUILD}.tar.gz \ - && tar zxf nginx-release-${NGINX_VERSION_BUILD}.tar.gz \ - && cd nginx-release-${NGINX_VERSION_BUILD} \ - && auto/configure \ - --with-compat \ - --add-dynamic-module=/src/opentracing \ - --with-debug \ - && make modules \ - && cp objs/ngx_http_opentracing_module.so /ngx_http_opentracing_module.so + && apt-get update \ + && apt-get install --no-install-recommends --no-install-suggests -y \ + libcurl4-openssl-dev \ + build-essential \ + cmake \ + git \ + ca-certificates \ + pkg-config \ + wget \ + libz-dev \ + automake \ + autogen \ + autoconf \ + libtool \ + libpcre3 \ + libpcre3-dev \ + && tempDir="$(mktemp -d)" \ + && chmod 777 "$tempDir" \ + && git clone https://github.com/opentracing-contrib/nginx-opentracing src \ + && cd "$tempDir" \ + && git clone -b v$OPENTRACING_CPP_VERSION https://github.com/opentracing/opentracing-cpp.git \ + && cd opentracing-cpp \ + && mkdir .build && cd .build \ + && cmake -DCMAKE_BUILD_TYPE=Release \ + -DBUILD_TESTING=OFF .. \ + && make && make install \ + && cd "$tempDir" \ + && NGINX_VERSION_BUILD=`nginx -v 2>&1` && NGINX_VERSION_BUILD=${NGINX_VERSION_BUILD#*nginx/} \ + && DEBIAN_VERSION="$(cat /etc/os-release | grep CODENAME | cut -f2 -d '=')" \ + && echo "deb-src http://nginx.org/packages/mainline/debian/ $DEBIAN_VERSION nginx" >> /etc/apt/sources.list \ + && apt-get update \ + && apt-get build-dep -y nginx=${NGINX_VERSION_BUILD} \ + && wget -O nginx-release-${NGINX_VERSION_BUILD}.tar.gz https://github.com/nginx/nginx/archive/release-${NGINX_VERSION_BUILD}.tar.gz \ + && tar zxf nginx-release-${NGINX_VERSION_BUILD}.tar.gz \ + && cd nginx-release-${NGINX_VERSION_BUILD} \ + && auto/configure \ + --with-compat \ + --add-dynamic-module=/src/opentracing \ + --with-debug \ + && make modules \ + && cp objs/ngx_http_opentracing_module.so /ngx_http_opentracing_module.so FROM debian:stretch-slim AS tracer-downloader ARG JAEGER_VERSION=v0.4.2 RUN set -x \ - && apt-get update \ - && apt-get install --no-install-recommends --no-install-suggests -y ca-certificates apt-transport-https wget \ - && wget https://github.com/jaegertracing/jaeger-client-cpp/releases/download/${JAEGER_VERSION}/libjaegertracing_plugin.linux_amd64.so -O /usr/local/lib/libjaegertracing_plugin.so + && apt-get update \ + && apt-get install --no-install-recommends --no-install-suggests -y ca-certificates apt-transport-https wget \ + && wget https://github.com/jaegertracing/jaeger-client-cpp/releases/download/${JAEGER_VERSION}/libjaegertracing_plugin.linux_amd64.so -O /usr/local/lib/libjaegertracing_plugin.so # Final Image @@ -63,8 +63,8 @@ ARG OPENTRACING_CPP_VERSION # forward nginx access and error logs to stdout and stderr of the ingress # controller process RUN ln -sf /proc/1/fd/1 /var/log/nginx/access.log \ - && ln -sf /proc/1/fd/1 /var/log/nginx/stream-access.log \ - && ln -sf /proc/1/fd/2 /var/log/nginx/error.log + && ln -sf /proc/1/fd/1 /var/log/nginx/stream-access.log \ + && ln -sf /proc/1/fd/2 /var/log/nginx/error.log COPY --from=opentracing-builder /ngx_http_opentracing_module.so /usr/lib/nginx/modules/ngx_http_opentracing_module.so COPY --from=opentracing-builder /usr/local/lib/libopentracing.so.${OPENTRACING_CPP_VERSION} /usr/local/lib/libopentracing.so.1 @@ -74,17 +74,17 @@ COPY --from=tracer-downloader /usr/local/lib/libjaegertracing_plugin.so /usr/loc RUN ldconfig RUN mkdir -p /var/lib/nginx \ - && mkdir -p /etc/nginx/secrets \ - && apt-get update \ - && apt-get install -y libcap2-bin \ - && setcap 'cap_net_bind_service=+ep' /usr/sbin/nginx \ - && setcap 'cap_net_bind_service=+ep' /usr/sbin/nginx-debug \ - && chown -R nginx:0 /etc/nginx \ - && chown -R nginx:0 /var/cache/nginx \ - && chown -R nginx:0 /var/lib/nginx \ - && apt-get remove --purge -y libcap2-bin \ - && rm /etc/nginx/conf.d/* \ - && rm -rf /var/lib/apt/lists/* + && mkdir -p /etc/nginx/secrets \ + && apt-get update \ + && apt-get install -y libcap2-bin \ + && setcap 'cap_net_bind_service=+ep' /usr/sbin/nginx \ + && setcap 'cap_net_bind_service=+ep' /usr/sbin/nginx-debug \ + && chown -R nginx:0 /etc/nginx \ + && chown -R nginx:0 /var/cache/nginx \ + && chown -R nginx:0 /var/lib/nginx \ + && apt-get remove --purge -y libcap2-bin \ + && rm /etc/nginx/conf.d/* \ + && rm -rf /var/lib/apt/lists/* COPY nginx-ingress internal/configs/version1/nginx.ingress.tmpl internal/configs/version1/nginx.tmpl internal/configs/version2/nginx.virtualserver.tmpl / diff --git a/build/DockerfileWithOpentracingForPlus b/build/DockerfileWithOpentracingForPlus index 8a15cd06a8..6cac983623 100644 --- a/build/DockerfileWithOpentracingForPlus +++ b/build/DockerfileWithOpentracingForPlus @@ -2,9 +2,9 @@ FROM debian:stretch-slim AS tracer-downloader ARG JAEGER_VERSION=v0.4.2 RUN set -x \ - && apt-get update \ - && apt-get install --no-install-recommends --no-install-suggests -y ca-certificates apt-transport-https wget \ - && wget https://github.com/jaegertracing/jaeger-client-cpp/releases/download/${JAEGER_VERSION}/libjaegertracing_plugin.linux_amd64.so -O /usr/local/lib/libjaegertracing_plugin.so + && apt-get update \ + && apt-get install --no-install-recommends --no-install-suggests -y ca-certificates apt-transport-https wget \ + && wget https://github.com/jaegertracing/jaeger-client-cpp/releases/download/${JAEGER_VERSION}/libjaegertracing_plugin.linux_amd64.so -O /usr/local/lib/libjaegertracing_plugin.so # Final Image FROM debian:stretch-slim @@ -25,55 +25,55 @@ RUN chmod 644 /etc/ssl/nginx/* # Install NGINX Plus RUN set -x \ - && apt-get update \ - && apt-get install --no-install-recommends --no-install-suggests -y apt-transport-https ca-certificates gnupg1 libcap2-bin \ - && \ - 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 \ - && echo "Acquire::https::plus-pkgs.nginx.com::User-Agent \"k8s-ic-$IC_VERSION-apt\";" >> /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 \ - && apt-get update && apt-get install -y \ - nginx-plus=${NGINX_PLUS_VERSION} \ - # Install OpenTracing module - nginx-plus-module-opentracing=${NGINX_OPENTRACING_MODULE_VERSION} \ - && setcap 'cap_net_bind_service=+ep' /usr/sbin/nginx \ - && setcap 'cap_net_bind_service=+ep' /usr/sbin/nginx-debug \ - && apt-get remove --purge --auto-remove -y gnupg1 \ - && rm -rf /var/lib/apt/lists/* \ - && rm -rf /etc/ssl/nginx \ - && rm /etc/apt/apt.conf.d/90nginx /etc/apt/sources.list.d/nginx-plus.list + && apt-get update \ + && apt-get install --no-install-recommends --no-install-suggests -y apt-transport-https ca-certificates gnupg1 libcap2-bin \ + && \ + 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 \ + && echo "Acquire::https::plus-pkgs.nginx.com::User-Agent \"k8s-ic-$IC_VERSION-apt\";" >> /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 \ + && apt-get update && apt-get install -y \ + nginx-plus=${NGINX_PLUS_VERSION} \ + # Install OpenTracing module + nginx-plus-module-opentracing=${NGINX_OPENTRACING_MODULE_VERSION} \ + && setcap 'cap_net_bind_service=+ep' /usr/sbin/nginx \ + && setcap 'cap_net_bind_service=+ep' /usr/sbin/nginx-debug \ + && apt-get remove --purge --auto-remove -y gnupg1 \ + && rm -rf /var/lib/apt/lists/* \ + && rm -rf /etc/ssl/nginx \ + && rm /etc/apt/apt.conf.d/90nginx /etc/apt/sources.list.d/nginx-plus.list # forward nginx access and error logs to stdout and stderr of the ingress # controller process RUN ln -sf /proc/1/fd/1 /var/log/nginx/access.log \ - && ln -sf /proc/1/fd/1 /var/log/nginx/stream-access.log \ - && ln -sf /proc/1/fd/2 /var/log/nginx/error.log + && ln -sf /proc/1/fd/1 /var/log/nginx/stream-access.log \ + && ln -sf /proc/1/fd/2 /var/log/nginx/error.log # Edit the line below to use a different tracer COPY --from=tracer-downloader /usr/local/lib/libjaegertracing_plugin.so /usr/local/lib/libjaegertracing_plugin.so RUN mkdir -p /var/lib/nginx \ - && mkdir -p /etc/nginx/secrets \ - && chown -R nginx:0 /etc/nginx \ - && chown -R nginx:0 /var/cache/nginx \ - && chown -R nginx:0 /var/lib/nginx/ \ - && apt-get remove --purge -y libcap2-bin \ - && rm /etc/nginx/conf.d/* + && mkdir -p /etc/nginx/secrets \ + && chown -R nginx:0 /etc/nginx \ + && chown -R nginx:0 /var/cache/nginx \ + && chown -R nginx:0 /var/lib/nginx/ \ + && apt-get remove --purge -y libcap2-bin \ + && rm /etc/nginx/conf.d/* EXPOSE 80 443 From 14aa31ba4d09c16c9eb858981776152cd49dabcb Mon Sep 17 00:00:00 2001 From: Dean Coakley Date: Wed, 4 Dec 2019 13:08:06 -0800 Subject: [PATCH 02/21] Add multi stage docker builds --- Makefile | 13 +++++++----- build/Dockerfile | 21 +++++++++++++++++-- build/DockerfileForAlpine | 21 +++++++++++++++++-- build/DockerfileForPlus | 28 ++++++++++++++++++++------ build/DockerfileWithOpentracing | 22 +++++++++++++++++--- build/DockerfileWithOpentracingForPlus | 26 +++++++++++++++++++----- 6 files changed, 108 insertions(+), 23 deletions(-) diff --git a/Makefile b/Makefile index 591cf93a79..e1e3b75d18 100644 --- a/Makefile +++ b/Makefile @@ -5,7 +5,6 @@ TAG = $(VERSION) PREFIX = nginx/nginx-ingress DOCKER_TEST_RUN = docker run --rm -v $(shell pwd):/go/src/github.com/nginxinc/kubernetes-ingress -w /go/src/github.com/nginxinc/kubernetes-ingress -DOCKER_BUILD_RUN = docker run --rm -v $(shell pwd):/go/src/github.com/nginxinc/kubernetes-ingress -w /go/src/github.com/nginxinc/kubernetes-ingress/cmd/nginx-ingress/ GOLANG_CONTAINER = golang:1.13 DOCKERFILEPATH = build DOCKERFILE = Dockerfile # note, this can be overwritten e.g. can be DOCKERFILE=DockerFileForPlus @@ -17,10 +16,10 @@ DOCKER_BUILD_OPTIONS = GIT_COMMIT=$(shell git rev-parse --short HEAD) +export DOCKER_BUILDKIT = 1 + nginx-ingress: -ifeq ($(BUILD_IN_CONTAINER),1) - $(DOCKER_BUILD_RUN) -e CGO_ENABLED=0 -e GO111MODULE=on -e GOFLAGS='-mod=vendor' $(GOLANG_CONTAINER) go build -installsuffix cgo -ldflags "-w -X main.version=${VERSION} -X main.gitCommit=${GIT_COMMIT}" -o /go/src/github.com/nginxinc/kubernetes-ingress/nginx-ingress -else +ifneq ($(BUILD_IN_CONTAINER),1) CGO_ENABLED=0 GO111MODULE=on GOFLAGS='-mod=vendor' GOOS=linux go build -installsuffix cgo -ldflags "-w -X main.version=${VERSION} -X main.gitCommit=${GIT_COMMIT}" -o nginx-ingress github.com/nginxinc/kubernetes-ingress/cmd/nginx-ingress endif @@ -49,7 +48,11 @@ endif container: test verify-codegen nginx-ingress certificate-and-key cp $(DOCKERFILEPATH)/$(DOCKERFILE) ./Dockerfile - docker build $(DOCKER_BUILD_OPTIONS) --build-arg IC_VERSION=$(VERSION)-$(GIT_COMMIT) -f Dockerfile -t $(PREFIX):$(TAG) . +ifeq ($(BUILD_IN_CONTAINER),1) + docker build $(DOCKER_BUILD_OPTIONS) --build-arg IC_VERSION=$(VERSION)-$(GIT_COMMIT) --target container -f Dockerfile -t $(PREFIX):$(TAG) . +else + docker build $(DOCKER_BUILD_OPTIONS) --build-arg IC_VERSION=$(VERSION)-$(GIT_COMMIT) --target local -f Dockerfile -t $(PREFIX):$(TAG) . +endif push: container ifeq ($(PUSH_TO_GCR),1) diff --git a/build/Dockerfile b/build/Dockerfile index 28cad0e9ed..1ed800833e 100644 --- a/build/Dockerfile +++ b/build/Dockerfile @@ -1,4 +1,4 @@ -FROM nginx:1.17.7 +FROM nginx:1.17.7 AS base # forward nginx access and error logs to stdout and stderr of the ingress # controller process @@ -19,7 +19,9 @@ RUN mkdir -p /var/lib/nginx \ && rm /etc/nginx/conf.d/* \ && rm -rf /var/lib/apt/lists/* -COPY nginx-ingress internal/configs/version1/nginx.ingress.tmpl internal/configs/version1/nginx.tmpl internal/configs/version2/nginx.virtualserver.tmpl / +COPY internal/configs/version1/nginx.ingress.tmpl \ + internal/configs/version1/nginx.tmpl \ + internal/configs/version2/nginx.virtualserver.tmpl / # Uncomment the line below if you would like to add the default.pem to the image # and use it as a certificate and key for the default server @@ -28,3 +30,18 @@ COPY nginx-ingress internal/configs/version1/nginx.ingress.tmpl internal/configs USER nginx ENTRYPOINT ["/nginx-ingress"] + + +FROM base AS local +COPY nginx-ingress / + + +FROM golang:1.13 AS builder +WORKDIR /go/src/github.com/nginxinc/kubernetes-ingress/nginx-ingress/cmd/nginx-ingress +COPY . /go/src/github.com/nginxinc/kubernetes-ingress/nginx-ingress/ +RUN CGO_ENABLED=0 GOFLAGS='-mod=vendor' \ + go build -installsuffix cgo -ldflags "-w -X main.version=${VERSION} -X main.gitCommit=${GIT_COMMIT}" -o /nginx-ingress + + +FROM base AS container +COPY --from=builder /nginx-ingress / diff --git a/build/DockerfileForAlpine b/build/DockerfileForAlpine index 67437c843c..fa20800129 100644 --- a/build/DockerfileForAlpine +++ b/build/DockerfileForAlpine @@ -1,4 +1,4 @@ -FROM nginx:1.17.7-alpine +FROM nginx:1.17.7-alpine AS base # forward nginx access and error logs to stdout and stderr of the ingress # controller process @@ -18,7 +18,9 @@ RUN mkdir -p /etc/nginx/secrets \ && rm /etc/nginx/conf.d/* \ && rm -rf /var/cache/apk/* -COPY nginx-ingress internal/configs/version1/nginx.ingress.tmpl internal/configs/version1/nginx.tmpl internal/configs/version2/nginx.virtualserver.tmpl / +COPY internal/configs/version1/nginx.ingress.tmpl \ + internal/configs/version1/nginx.tmpl \ + internal/configs/version2/nginx.virtualserver.tmpl / # Uncomment the line below if you would like to add the default.pem to the image # and use it as a certificate and key for the default server @@ -27,3 +29,18 @@ COPY nginx-ingress internal/configs/version1/nginx.ingress.tmpl internal/configs USER nginx ENTRYPOINT ["/nginx-ingress"] + + +FROM base AS local +COPY nginx-ingress / + + +FROM golang:1.13 AS builder +WORKDIR /go/src/github.com/nginxinc/kubernetes-ingress/nginx-ingress/cmd/nginx-ingress +COPY . /go/src/github.com/nginxinc/kubernetes-ingress/nginx-ingress/ +RUN CGO_ENABLED=0 GOFLAGS='-mod=vendor' \ + go build -installsuffix cgo -ldflags "-w -X main.version=${VERSION} -X main.gitCommit=${GIT_COMMIT}" -o /nginx-ingress + + +FROM base AS container +COPY --from=builder /nginx-ingress / \ No newline at end of file diff --git a/build/DockerfileForPlus b/build/DockerfileForPlus index 4f25deabb9..434229d74a 100644 --- a/build/DockerfileForPlus +++ b/build/DockerfileForPlus @@ -1,4 +1,4 @@ -FROM debian:stretch-slim +FROM debian:stretch-slim AS base LABEL maintainer="NGINX Docker Maintainers " @@ -7,8 +7,7 @@ ARG IC_VERSION # Download certificate and key from the customer portal (https://cs.nginx.com) # and copy to the build context -COPY nginx-repo.crt /etc/ssl/nginx/ -COPY nginx-repo.key /etc/ssl/nginx/ +COPY nginx-repo.crt nginx-repo.key /etc/ssl/nginx/ # Make sure the certificate and key have correct permissions RUN chmod 644 /etc/ssl/nginx/* @@ -51,7 +50,7 @@ RUN ln -sf /proc/1/fd/1 /var/log/nginx/access.log \ && ln -sf /proc/1/fd/1 /var/log/nginx/stream-access.log \ && ln -sf /proc/1/fd/2 /var/log/nginx/error.log -RUN mkdir -p /var/lib/nginx \ +RUN mkdir -p /var/lib/nginx \ && mkdir -p /etc/nginx/secrets \ && chown -R nginx:0 /etc/nginx \ && chown -R nginx:0 /var/cache/nginx \ @@ -61,7 +60,9 @@ RUN mkdir -p /var/lib/nginx \ EXPOSE 80 443 -COPY nginx-ingress internal/configs/version1/nginx-plus.ingress.tmpl internal/configs/version1/nginx-plus.tmpl internal/configs/version2/nginx-plus.virtualserver.tmpl / +COPY internal/configs/version1/nginx-plus.ingress.tmpl \ + internal/configs/version1/nginx-plus.tmpl \ + internal/configs/version2/nginx-plus.virtualserver.tmpl / # Uncomment the line below if you would like to add the default.pem to the image # and use it as a certificate and key for the default server @@ -69,4 +70,19 @@ COPY nginx-ingress internal/configs/version1/nginx-plus.ingress.tmpl internal/co USER nginx -ENTRYPOINT ["/nginx-ingress"] \ No newline at end of file +ENTRYPOINT ["/nginx-ingress"] + + +FROM base AS local +COPY nginx-ingress / + + +FROM golang:1.13 AS builder +WORKDIR /go/src/github.com/nginxinc/kubernetes-ingress/nginx-ingress/cmd/nginx-ingress +COPY . /go/src/github.com/nginxinc/kubernetes-ingress/nginx-ingress/ +RUN CGO_ENABLED=0 GOFLAGS='-mod=vendor' \ + go build -installsuffix cgo -ldflags "-w -X main.version=${VERSION} -X main.gitCommit=${GIT_COMMIT}" -o /nginx-ingress + + +FROM base AS container +COPY --from=builder /nginx-ingress / diff --git a/build/DockerfileWithOpentracing b/build/DockerfileWithOpentracing index c5171faf66..ccbeb14dc5 100644 --- a/build/DockerfileWithOpentracing +++ b/build/DockerfileWithOpentracing @@ -45,7 +45,7 @@ RUN set -x \ --add-dynamic-module=/src/opentracing \ --with-debug \ && make modules \ - && cp objs/ngx_http_opentracing_module.so /ngx_http_opentracing_module.so + && cp objs/ngx_http_opentracing_module.so /ngx_http_opentracing_module.so FROM debian:stretch-slim AS tracer-downloader @@ -57,7 +57,7 @@ RUN set -x \ # Final Image -FROM nginx:${NGINX_VERSION} +FROM nginx:${NGINX_VERSION} AS base ARG OPENTRACING_CPP_VERSION # forward nginx access and error logs to stdout and stderr of the ingress @@ -86,7 +86,9 @@ RUN mkdir -p /var/lib/nginx \ && rm /etc/nginx/conf.d/* \ && rm -rf /var/lib/apt/lists/* -COPY nginx-ingress internal/configs/version1/nginx.ingress.tmpl internal/configs/version1/nginx.tmpl internal/configs/version2/nginx.virtualserver.tmpl / +COPY internal/configs/version1/nginx.ingress.tmpl \ + internal/configs/version1/nginx.tmpl \ + internal/configs/version2/nginx.virtualserver.tmpl / # Uncomment the line below if you would like to add the default.pem to the image # and use it as a certificate and key for the default server @@ -95,3 +97,17 @@ COPY nginx-ingress internal/configs/version1/nginx.ingress.tmpl internal/configs USER nginx ENTRYPOINT ["/nginx-ingress"] + +FROM base AS local +COPY nginx-ingress / + + +FROM golang:1.13 AS builder +WORKDIR /go/src/github.com/nginxinc/kubernetes-ingress/nginx-ingress/cmd/nginx-ingress +COPY . /go/src/github.com/nginxinc/kubernetes-ingress/nginx-ingress/ +RUN CGO_ENABLED=0 GOFLAGS='-mod=vendor' \ + go build -installsuffix cgo -ldflags "-w -X main.version=${VERSION} -X main.gitCommit=${GIT_COMMIT}" -o /nginx-ingress + + +FROM base AS container +COPY --from=builder /nginx-ingress / diff --git a/build/DockerfileWithOpentracingForPlus b/build/DockerfileWithOpentracingForPlus index 6cac983623..8e4cd58103 100644 --- a/build/DockerfileWithOpentracingForPlus +++ b/build/DockerfileWithOpentracingForPlus @@ -7,7 +7,7 @@ RUN set -x \ && wget https://github.com/jaegertracing/jaeger-client-cpp/releases/download/${JAEGER_VERSION}/libjaegertracing_plugin.linux_amd64.so -O /usr/local/lib/libjaegertracing_plugin.so # Final Image -FROM debian:stretch-slim +FROM debian:stretch-slim AS base LABEL maintainer="NGINX Docker Maintainers " ENV NGINX_PLUS_VERSION 20-1~stretch @@ -17,8 +17,7 @@ ARG IC_VERSION # Download certificate and key from the customer portal (https://cs.nginx.com) # and copy to the build context -COPY nginx-repo.crt /etc/ssl/nginx/ -COPY nginx-repo.key /etc/ssl/nginx/ +COPY nginx-repo.crt nginx-repo.key /etc/ssl/nginx/ # Make sure the certificate and key have correct permissions RUN chmod 644 /etc/ssl/nginx/* @@ -77,7 +76,9 @@ RUN mkdir -p /var/lib/nginx \ EXPOSE 80 443 -COPY nginx-ingress internal/configs/version1/nginx-plus.ingress.tmpl internal/configs/version1/nginx-plus.tmpl internal/configs/version2/nginx-plus.virtualserver.tmpl / +COPY internal/configs/version1/nginx-plus.ingress.tmpl \ + internal/configs/version1/nginx-plus.tmpl \ + internal/configs/version2/nginx-plus.virtualserver.tmpl / # Uncomment the line below if you would like to add the default.pem to the image # and use it as a certificate and key for the default server @@ -85,4 +86,19 @@ COPY nginx-ingress internal/configs/version1/nginx-plus.ingress.tmpl internal/co USER nginx -ENTRYPOINT ["/nginx-ingress"] \ No newline at end of file +ENTRYPOINT ["/nginx-ingress"] + + +FROM base AS local +COPY nginx-ingress / + + +FROM golang:1.13 AS builder +WORKDIR /go/src/github.com/nginxinc/kubernetes-ingress/nginx-ingress/cmd/nginx-ingress +COPY . /go/src/github.com/nginxinc/kubernetes-ingress/nginx-ingress/ +RUN CGO_ENABLED=0 GOFLAGS='-mod=vendor' \ + go build -installsuffix cgo -ldflags "-w -X main.version=${VERSION} -X main.gitCommit=${GIT_COMMIT}" -o /nginx-ingress + + +FROM base AS container +COPY --from=builder /nginx-ingress / From 8d6342a6300e54f4cd8662b32f5218b582dcd0f0 Mon Sep 17 00:00:00 2001 From: Dean Coakley Date: Thu, 16 Jan 2020 16:19:57 +0000 Subject: [PATCH 03/21] Update docker for travisci --- .travis.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.travis.yml b/.travis.yml index 34fbc1ca1e..2ca00466cf 100644 --- a/.travis.yml +++ b/.travis.yml @@ -21,3 +21,7 @@ before_install: && GO111MODULE=on FOSSA_API_KEY=${fossapush} ./fossa analyze -t kubernetes-ingress -b ${TRAVIS_BRANCH}; fi - echo "Checking ingress controller for linting errors" && wget -O - -q ${golangci_lint} | sh -s v1.17.1 - export PATH="$PATH:./bin" && make lint +addons: + apt: + packages: + - docker-ce From 6085b7f12423cb547100b5297fe600fb64010990 Mon Sep 17 00:00:00 2001 From: Dean Coakley Date: Mon, 20 Jan 2020 11:28:47 +0000 Subject: [PATCH 04/21] Try update docker in travisci --- .travis.yml | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/.travis.yml b/.travis.yml index 2ca00466cf..a9f3855b09 100644 --- a/.travis.yml +++ b/.travis.yml @@ -21,7 +21,8 @@ before_install: && GO111MODULE=on FOSSA_API_KEY=${fossapush} ./fossa analyze -t kubernetes-ingress -b ${TRAVIS_BRANCH}; fi - echo "Checking ingress controller for linting errors" && wget -O - -q ${golangci_lint} | sh -s v1.17.1 - export PATH="$PATH:./bin" && make lint -addons: - apt: - packages: - - docker-ce +- echo "Updating docker to latest stable release" +- curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add - +- sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable" +- sudo apt-get update +- sudo apt-get -y -o Dpkg::Options::="--force-confnew" install docker-ce From baea83e6e0e100e9c18870eea173dd76ef4a8c49 Mon Sep 17 00:00:00 2001 From: Dean Coakley Date: Mon, 20 Jan 2020 12:50:19 +0000 Subject: [PATCH 05/21] Improve targets --- Makefile | 33 ++++++++++----------------------- 1 file changed, 10 insertions(+), 23 deletions(-) diff --git a/Makefile b/Makefile index e1e3b75d18..88a7ae2b77 100644 --- a/Makefile +++ b/Makefile @@ -9,7 +9,6 @@ GOLANG_CONTAINER = golang:1.13 DOCKERFILEPATH = build DOCKERFILE = Dockerfile # note, this can be overwritten e.g. can be DOCKERFILE=DockerFileForPlus -BUILD_IN_CONTAINER = 1 PUSH_TO_GCR = GENERATE_DEFAULT_CERT_AND_KEY = DOCKER_BUILD_OPTIONS = @@ -18,25 +17,11 @@ GIT_COMMIT=$(shell git rev-parse --short HEAD) export DOCKER_BUILDKIT = 1 -nginx-ingress: -ifneq ($(BUILD_IN_CONTAINER),1) - CGO_ENABLED=0 GO111MODULE=on GOFLAGS='-mod=vendor' GOOS=linux go build -installsuffix cgo -ldflags "-w -X main.version=${VERSION} -X main.gitCommit=${GIT_COMMIT}" -o nginx-ingress github.com/nginxinc/kubernetes-ingress/cmd/nginx-ingress -endif - lint: golangci-lint run -test: -ifeq ($(BUILD_IN_CONTAINER),1) - $(DOCKER_TEST_RUN) -e GO111MODULE=on -e GOFLAGS='-mod=vendor' $(GOLANG_CONTAINER) go test ./... -else - GO111MODULE=on GOFLAGS='-mod=vendor' go test ./... -endif - verify-codegen: -ifneq ($(BUILD_IN_CONTAINER), 1) ./hack/verify-codegen.sh -endif update-codegen: ./hack/update-codegen.sh @@ -46,13 +31,16 @@ ifeq ($(GENERATE_DEFAULT_CERT_AND_KEY),1) ./build/generate_default_cert_and_key.sh endif -container: test verify-codegen nginx-ingress certificate-and-key - cp $(DOCKERFILEPATH)/$(DOCKERFILE) ./Dockerfile -ifeq ($(BUILD_IN_CONTAINER),1) - docker build $(DOCKER_BUILD_OPTIONS) --build-arg IC_VERSION=$(VERSION)-$(GIT_COMMIT) --target container -f Dockerfile -t $(PREFIX):$(TAG) . -else - docker build $(DOCKER_BUILD_OPTIONS) --build-arg IC_VERSION=$(VERSION)-$(GIT_COMMIT) --target local -f Dockerfile -t $(PREFIX):$(TAG) . -endif +binary: + CGO_ENABLED=0 GO111MODULE=on GOFLAGS='-mod=vendor' GOOS=linux go build -installsuffix cgo -ldflags "-w -X main.version=${VERSION} -X main.gitCommit=${GIT_COMMIT}" -o nginx-ingress github.com/nginxinc/kubernetes-ingress/cmd/nginx-ingress + +local-container: binary verify-codegen certificate-and-key + GO111MODULE=on GOFLAGS='-mod=vendor' go test ./... + docker build $(DOCKER_BUILD_OPTIONS) --build-arg IC_VERSION=$(VERSION)-$(GIT_COMMIT) --target local -f $(DOCKERFILEPATH)/$(DOCKERFILE) -t $(PREFIX):$(TAG) . + +container: certificate-and-key + $(DOCKER_TEST_RUN) -e GO111MODULE=on -e GOFLAGS='-mod=vendor' $(GOLANG_CONTAINER) go test ./... + docker build $(DOCKER_BUILD_OPTIONS) --build-arg IC_VERSION=$(VERSION)-$(GIT_COMMIT) --target container -f $(DOCKERFILEPATH)/$(DOCKERFILE) -t $(PREFIX):$(TAG) . push: container ifeq ($(PUSH_TO_GCR),1) @@ -63,4 +51,3 @@ endif clean: rm -f nginx-ingress - rm -f Dockerfile From 12dd336eebc3902b01efc1567b63aec82c492d53 Mon Sep 17 00:00:00 2001 From: Dean Coakley Date: Mon, 20 Jan 2020 12:51:42 +0000 Subject: [PATCH 06/21] Fix travis file --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index a9f3855b09..38804180b6 100644 --- a/.travis.yml +++ b/.travis.yml @@ -6,7 +6,7 @@ go: - "1.13" script: - echo "Building ingress controller commit:${TRAVIS_COMMIT}" -- make BUILD_IN_CONTAINER=0 container; +- make local-container; - echo "Helm smoke test" - cd ${TRAVIS_BUILD_DIR} && wget -O helm.tar.gz ${helm_download} && tar xzfv helm.tar.gz -C ./ --strip-components=1 linux-amd64/helm From 05a74fd14d608eba98a36a7878f106a97d856726 Mon Sep 17 00:00:00 2001 From: Dean Coakley Date: Tue, 21 Jan 2020 12:16:45 +0000 Subject: [PATCH 07/21] Test docker versions --- .travis.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.travis.yml b/.travis.yml index 38804180b6..009ba3396e 100644 --- a/.travis.yml +++ b/.travis.yml @@ -25,4 +25,7 @@ before_install: - curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add - - sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable" - sudo apt-get update +- apt-cache madison docker-ce +- docker version - sudo apt-get -y -o Dpkg::Options::="--force-confnew" install docker-ce +- docker version \ No newline at end of file From 1ac75e47a23ed05bce643c5172e6d2d882f562dc Mon Sep 17 00:00:00 2001 From: Dean Coakley Date: Tue, 21 Jan 2020 12:32:35 +0000 Subject: [PATCH 08/21] Try docker 18.09 --- .travis.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index 009ba3396e..3904e86ecb 100644 --- a/.travis.yml +++ b/.travis.yml @@ -25,7 +25,6 @@ before_install: - curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add - - sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable" - sudo apt-get update -- apt-cache madison docker-ce - docker version -- sudo apt-get -y -o Dpkg::Options::="--force-confnew" install docker-ce +- sudo apt-get -y -o Dpkg::Options::="--force-confnew" install docker-ce=5:18.09.9~3-0~ubuntu-xenial - docker version \ No newline at end of file From 50431193431ede0026ebffff9ae3bdc73b91861b Mon Sep 17 00:00:00 2001 From: dboenig Date: Tue, 21 Jan 2020 14:04:13 +0000 Subject: [PATCH 09/21] Upgrade Docker version to 19.03.5 --- .travis.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index 3904e86ecb..21b1c6e5b3 100644 --- a/.travis.yml +++ b/.travis.yml @@ -25,6 +25,5 @@ before_install: - curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add - - sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable" - sudo apt-get update -- docker version -- sudo apt-get -y -o Dpkg::Options::="--force-confnew" install docker-ce=5:18.09.9~3-0~ubuntu-xenial +- sudo apt-get -y -o Dpkg::Options::="--force-confnew" install docker-ce=5:19.03.5~3-0~ubuntu-xenial - docker version \ No newline at end of file From 4007b14f03e3f0df5a78ddb4f2e4316da8adf47a Mon Sep 17 00:00:00 2001 From: dboenig Date: Tue, 21 Jan 2020 15:39:38 +0000 Subject: [PATCH 10/21] Remove Docker upgrade and BUILDKIT from travis --- .travis.yml | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/.travis.yml b/.travis.yml index 21b1c6e5b3..0ba3c1d2ca 100644 --- a/.travis.yml +++ b/.travis.yml @@ -6,7 +6,7 @@ go: - "1.13" script: - echo "Building ingress controller commit:${TRAVIS_COMMIT}" -- make local-container; +- DOCKER_BUILDKIT=0 make local-container; - echo "Helm smoke test" - cd ${TRAVIS_BUILD_DIR} && wget -O helm.tar.gz ${helm_download} && tar xzfv helm.tar.gz -C ./ --strip-components=1 linux-amd64/helm @@ -20,10 +20,4 @@ before_install: && ./fossa init && GO111MODULE=on FOSSA_API_KEY=${fossapush} ./fossa analyze -t kubernetes-ingress -b ${TRAVIS_BRANCH}; fi - echo "Checking ingress controller for linting errors" && wget -O - -q ${golangci_lint} | sh -s v1.17.1 -- export PATH="$PATH:./bin" && make lint -- echo "Updating docker to latest stable release" -- curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add - -- sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable" -- sudo apt-get update -- sudo apt-get -y -o Dpkg::Options::="--force-confnew" install docker-ce=5:19.03.5~3-0~ubuntu-xenial -- docker version \ No newline at end of file +- export PATH="$PATH:./bin" && make lint \ No newline at end of file From 1fbf9bbedb4a2ae864816f2bbc9b36329abff4eb Mon Sep 17 00:00:00 2001 From: dboenig Date: Tue, 21 Jan 2020 15:46:40 +0000 Subject: [PATCH 11/21] Fixed typo in local-container --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 0ba3c1d2ca..a3728cee28 100644 --- a/.travis.yml +++ b/.travis.yml @@ -6,7 +6,7 @@ go: - "1.13" script: - echo "Building ingress controller commit:${TRAVIS_COMMIT}" -- DOCKER_BUILDKIT=0 make local-container; +- make local-container DOCKER_BUILDKIT=0; - echo "Helm smoke test" - cd ${TRAVIS_BUILD_DIR} && wget -O helm.tar.gz ${helm_download} && tar xzfv helm.tar.gz -C ./ --strip-components=1 linux-amd64/helm From f5979819ee428cec4dd771c972c86b7c13b75cee Mon Sep 17 00:00:00 2001 From: Dean Coakley Date: Tue, 21 Jan 2020 16:29:10 +0000 Subject: [PATCH 12/21] Re-add test target to Makefile --- Makefile | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index 88a7ae2b77..375c22b702 100644 --- a/Makefile +++ b/Makefile @@ -20,6 +20,9 @@ export DOCKER_BUILDKIT = 1 lint: golangci-lint run +test: + GO111MODULE=on GOFLAGS='-mod=vendor' go test ./... + verify-codegen: ./hack/verify-codegen.sh @@ -34,8 +37,7 @@ endif binary: CGO_ENABLED=0 GO111MODULE=on GOFLAGS='-mod=vendor' GOOS=linux go build -installsuffix cgo -ldflags "-w -X main.version=${VERSION} -X main.gitCommit=${GIT_COMMIT}" -o nginx-ingress github.com/nginxinc/kubernetes-ingress/cmd/nginx-ingress -local-container: binary verify-codegen certificate-and-key - GO111MODULE=on GOFLAGS='-mod=vendor' go test ./... +local-container: test binary verify-codegen certificate-and-key docker build $(DOCKER_BUILD_OPTIONS) --build-arg IC_VERSION=$(VERSION)-$(GIT_COMMIT) --target local -f $(DOCKERFILEPATH)/$(DOCKERFILE) -t $(PREFIX):$(TAG) . container: certificate-and-key From be8cd0bd10fd8e6b1fcb216541ecdd419343f4ed Mon Sep 17 00:00:00 2001 From: Dean Coakley Date: Tue, 21 Jan 2020 16:29:20 +0000 Subject: [PATCH 13/21] Update Makefile docs --- .../installation/building-ingress-controller-image.md | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/docs-web/installation/building-ingress-controller-image.md b/docs-web/installation/building-ingress-controller-image.md index 6ae03e3b46..85581e79ba 100644 --- a/docs-web/installation/building-ingress-controller-image.md +++ b/docs-web/installation/building-ingress-controller-image.md @@ -31,7 +31,7 @@ We build the image using the make utility and the provided `Makefile`. Let’s c $ make PREFIX=myregistry.example.com/nginx-ingress ``` `myregistry.example.com/nginx-ingress` defines the repo in your private registry where the image will be pushed. Substitute that value with the repo in your private registry. - + As the result, the image **myregistry.example.com/nginx-ingress:edge** is built and pushed to the registry. Note that the tag `edge` comes from the `VERSION` variable, defined in the Makefile. * For NGINX Plus, first, make sure that the certificate (`nginx-repo.crt`) and the key (`nginx-repo.key`) of your license are located in the root of the project: @@ -45,7 +45,7 @@ We build the image using the make utility and the provided `Makefile`. Let’s c $ make DOCKERFILE=DockerfileForPlus PREFIX=myregistry.example.com/nginx-plus-ingress ``` `myregistry.example.com/nginx-plus-ingress` defines the repo in your private registry where the image will be pushed. Substitute that value with the repo in your private registry. - + As the result, the image **myregistry.example.com/nginx-plus-ingress:edge** is built and pushed to the registry. Note that the tag `edge` comes from the `VERSION` variable, defined in the Makefile. Next you will find the details about available Makefile targets and variables. @@ -54,7 +54,8 @@ Next you will find the details about available Makefile targets and variables. The **Makefile** we provide has the following targets: * **test**: runs unit tests. -* **nginx-ingress**: creates the controller binary. +* **binary**: creates the controller binary. +* **local-container**: builds a Docker image using the local install of go. * **container**: builds a Docker image. * **push**: pushes the image to the private Docker registry. * **all** (the default target): executes the four targets above in the order listed. If one of the targets fails, the execution process stops, reporting an error. @@ -74,6 +75,3 @@ The **Makefile** contains the following main variables for you to customize (eit 1. `DockerfileWithOpentracingForPlus`, for building a debian-based image with NGINX Plus, [opentracing](https://github.com/opentracing-contrib/nginx-opentracing) module and the [Jaeger](https://www.jaegertracing.io/) tracer. * **GENERATE_DEFAULT_CERT_AND_KEY** - The Ingress controller requires a certificate and a key for the default HTTP/HTTPS server. You can reference them in a TLS Secret in a command-line argument to the Ingress controller. As an alternative, you can add a file in the PEM format with your certificate and key to the image as `/etc/nginx/secrets/default`. Optionally, you can generate a self-signed certificate and a key during the build process. Set `GENERATE_DEFAULT_CERT_AND_KEY` to `1` to generate a certificate and a key in the `default.pem` file. Note that you must add the `ADD` instruction in the Dockerfile to copy the cert and the key to the image. The default value of `GENERATE_DEFAULT_CERT_AND_KEY` is `0`. * **DOCKER_BUILD_OPTIONS** -- the [options](https://docs.docker.com/engine/reference/commandline/build/#options) for the `docker build` command. For example, `--pull`. -* **BUILD_IN_CONTAINER** -- By default, to compile the controller we use the [golang](https://hub.docker.com/_/golang/) container that we run as part of the building process. If you want to compile the controller using your local golang environment: - 1. Make sure that the Ingress controller repo is in your `$GOPATH`. - 1. Specify `BUILD_IN_CONTAINER=0` when you run the make command. From d1d1fdb6ad48db2b87eb31dd87bda9ba731617d9 Mon Sep 17 00:00:00 2001 From: Dean Coakley Date: Wed, 22 Jan 2020 16:58:14 +0000 Subject: [PATCH 14/21] Make default behaviour consistent with master. Docs --- Makefile | 3 +-- docs-web/installation/building-ingress-controller-image.md | 2 +- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/Makefile b/Makefile index 375c22b702..c67e393617 100644 --- a/Makefile +++ b/Makefile @@ -41,10 +41,9 @@ local-container: test binary verify-codegen certificate-and-key docker build $(DOCKER_BUILD_OPTIONS) --build-arg IC_VERSION=$(VERSION)-$(GIT_COMMIT) --target local -f $(DOCKERFILEPATH)/$(DOCKERFILE) -t $(PREFIX):$(TAG) . container: certificate-and-key - $(DOCKER_TEST_RUN) -e GO111MODULE=on -e GOFLAGS='-mod=vendor' $(GOLANG_CONTAINER) go test ./... docker build $(DOCKER_BUILD_OPTIONS) --build-arg IC_VERSION=$(VERSION)-$(GIT_COMMIT) --target container -f $(DOCKERFILEPATH)/$(DOCKERFILE) -t $(PREFIX):$(TAG) . -push: container +push: local-container ifeq ($(PUSH_TO_GCR),1) gcloud docker -- push $(PREFIX):$(TAG) else diff --git a/docs-web/installation/building-ingress-controller-image.md b/docs-web/installation/building-ingress-controller-image.md index 85581e79ba..d71511ea1e 100644 --- a/docs-web/installation/building-ingress-controller-image.md +++ b/docs-web/installation/building-ingress-controller-image.md @@ -5,7 +5,7 @@ This document explains how to build an Ingress Controller image. Note that for N ## Prerequisites Before you can build the image, make sure that the following software is installed on your machine: -* [Docker](https://www.docker.com/products/docker) +* [Docker](https://www.docker.com/products/docker) v18.09+ * [GNU Make](https://www.gnu.org/software/make/) * [git](https://git-scm.com/) * [OpenSSL](https://www.openssl.org/), optionally, if you would like to generate a self-signed certificate and a key for the default server. From 3953b3ef5b93013517d6b3f3dba36a3d6eae23bf Mon Sep 17 00:00:00 2001 From: Dean Coakley Date: Thu, 23 Jan 2020 16:47:47 +0000 Subject: [PATCH 15/21] More consistency improvements --- Makefile | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/Makefile b/Makefile index c67e393617..b4694fc769 100644 --- a/Makefile +++ b/Makefile @@ -9,6 +9,7 @@ GOLANG_CONTAINER = golang:1.13 DOCKERFILEPATH = build DOCKERFILE = Dockerfile # note, this can be overwritten e.g. can be DOCKERFILE=DockerFileForPlus +BUILD_IN_CONTAINER = 1 PUSH_TO_GCR = GENERATE_DEFAULT_CERT_AND_KEY = DOCKER_BUILD_OPTIONS = @@ -21,10 +22,14 @@ lint: golangci-lint run test: +ifneq ($(BUILD_IN_CONTAINER),1) GO111MODULE=on GOFLAGS='-mod=vendor' go test ./... +endif verify-codegen: +ifneq ($(BUILD_IN_CONTAINER),1) ./hack/verify-codegen.sh +endif update-codegen: ./hack/update-codegen.sh @@ -35,15 +40,18 @@ ifeq ($(GENERATE_DEFAULT_CERT_AND_KEY),1) endif binary: +ifneq ($(BUILD_IN_CONTAINER),1) CGO_ENABLED=0 GO111MODULE=on GOFLAGS='-mod=vendor' GOOS=linux go build -installsuffix cgo -ldflags "-w -X main.version=${VERSION} -X main.gitCommit=${GIT_COMMIT}" -o nginx-ingress github.com/nginxinc/kubernetes-ingress/cmd/nginx-ingress +endif -local-container: test binary verify-codegen certificate-and-key - docker build $(DOCKER_BUILD_OPTIONS) --build-arg IC_VERSION=$(VERSION)-$(GIT_COMMIT) --target local -f $(DOCKERFILEPATH)/$(DOCKERFILE) -t $(PREFIX):$(TAG) . - -container: certificate-and-key +container: test verify-codegen binary certificate-and-key +ifeq ($(BUILD_IN_CONTAINER),1) docker build $(DOCKER_BUILD_OPTIONS) --build-arg IC_VERSION=$(VERSION)-$(GIT_COMMIT) --target container -f $(DOCKERFILEPATH)/$(DOCKERFILE) -t $(PREFIX):$(TAG) . +else + docker build $(DOCKER_BUILD_OPTIONS) --build-arg IC_VERSION=$(VERSION)-$(GIT_COMMIT) --target local -f $(DOCKERFILEPATH)/$(DOCKERFILE) -t $(PREFIX):$(TAG) . +endif -push: local-container +push: container ifeq ($(PUSH_TO_GCR),1) gcloud docker -- push $(PREFIX):$(TAG) else From 21540d76a0b3dbd835b08a8cba26a6d6fa35623a Mon Sep 17 00:00:00 2001 From: Dean Coakley Date: Thu, 23 Jan 2020 16:56:19 +0000 Subject: [PATCH 16/21] Remove local-container target --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index a3728cee28..f3da017b22 100644 --- a/.travis.yml +++ b/.travis.yml @@ -6,7 +6,7 @@ go: - "1.13" script: - echo "Building ingress controller commit:${TRAVIS_COMMIT}" -- make local-container DOCKER_BUILDKIT=0; +- make container BUILD_IN_CONTAINER=0 DOCKER_BUILDKIT=0; - echo "Helm smoke test" - cd ${TRAVIS_BUILD_DIR} && wget -O helm.tar.gz ${helm_download} && tar xzfv helm.tar.gz -C ./ --strip-components=1 linux-amd64/helm From c466ee807ad9d32da1f60bb4452f248198a3be56 Mon Sep 17 00:00:00 2001 From: Dean Coakley Date: Thu, 23 Jan 2020 16:59:58 +0000 Subject: [PATCH 17/21] Fix docs --- docs-web/installation/building-ingress-controller-image.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/docs-web/installation/building-ingress-controller-image.md b/docs-web/installation/building-ingress-controller-image.md index d71511ea1e..e1c129cbaa 100644 --- a/docs-web/installation/building-ingress-controller-image.md +++ b/docs-web/installation/building-ingress-controller-image.md @@ -55,7 +55,6 @@ Next you will find the details about available Makefile targets and variables. The **Makefile** we provide has the following targets: * **test**: runs unit tests. * **binary**: creates the controller binary. -* **local-container**: builds a Docker image using the local install of go. * **container**: builds a Docker image. * **push**: pushes the image to the private Docker registry. * **all** (the default target): executes the four targets above in the order listed. If one of the targets fails, the execution process stops, reporting an error. @@ -75,3 +74,6 @@ The **Makefile** contains the following main variables for you to customize (eit 1. `DockerfileWithOpentracingForPlus`, for building a debian-based image with NGINX Plus, [opentracing](https://github.com/opentracing-contrib/nginx-opentracing) module and the [Jaeger](https://www.jaegertracing.io/) tracer. * **GENERATE_DEFAULT_CERT_AND_KEY** - The Ingress controller requires a certificate and a key for the default HTTP/HTTPS server. You can reference them in a TLS Secret in a command-line argument to the Ingress controller. As an alternative, you can add a file in the PEM format with your certificate and key to the image as `/etc/nginx/secrets/default`. Optionally, you can generate a self-signed certificate and a key during the build process. Set `GENERATE_DEFAULT_CERT_AND_KEY` to `1` to generate a certificate and a key in the `default.pem` file. Note that you must add the `ADD` instruction in the Dockerfile to copy the cert and the key to the image. The default value of `GENERATE_DEFAULT_CERT_AND_KEY` is `0`. * **DOCKER_BUILD_OPTIONS** -- the [options](https://docs.docker.com/engine/reference/commandline/build/#options) for the `docker build` command. For example, `--pull`. +* **BUILD_IN_CONTAINER** -- By default, to compile the controller we use the [golang](https://hub.docker.com/_/golang/) container that we run as part of the building process. If you want to compile the controller using your local golang environment: + 1. Make sure that the Ingress controller repo is in your `$GOPATH`. + 1. Specify `BUILD_IN_CONTAINER=0` when you run the make command. From 932080fd4ade2a0124ffdbff9ef949134c1d29cb Mon Sep 17 00:00:00 2001 From: Dean Coakley Date: Thu, 23 Jan 2020 17:55:52 +0000 Subject: [PATCH 18/21] Remove unnecessary Makefile args --- Makefile | 2 -- 1 file changed, 2 deletions(-) diff --git a/Makefile b/Makefile index b4694fc769..f01ca518d1 100644 --- a/Makefile +++ b/Makefile @@ -4,8 +4,6 @@ VERSION = edge TAG = $(VERSION) PREFIX = nginx/nginx-ingress -DOCKER_TEST_RUN = docker run --rm -v $(shell pwd):/go/src/github.com/nginxinc/kubernetes-ingress -w /go/src/github.com/nginxinc/kubernetes-ingress -GOLANG_CONTAINER = golang:1.13 DOCKERFILEPATH = build DOCKERFILE = Dockerfile # note, this can be overwritten e.g. can be DOCKERFILE=DockerFileForPlus From 0008a51deb953816767d2405793ee17c4885db89 Mon Sep 17 00:00:00 2001 From: Dean Coakley Date: Fri, 24 Jan 2020 17:33:11 +0000 Subject: [PATCH 19/21] Fix setting build args. PR feedback --- .gitignore | 3 --- Makefile | 5 +++-- build/Dockerfile | 6 +++++- build/DockerfileForAlpine | 6 +++++- build/DockerfileForPlus | 6 +++++- build/DockerfileWithOpentracing | 5 ++++- build/DockerfileWithOpentracingForPlus | 3 +++ docs-web/installation/building-ingress-controller-image.md | 4 ++-- 8 files changed, 27 insertions(+), 11 deletions(-) diff --git a/.gitignore b/.gitignore index 5606b93b65..c96973cf9f 100644 --- a/.gitignore +++ b/.gitignore @@ -39,8 +39,5 @@ cmd/nginx-ingress/nginx-ingress # Default certificate and key default.pem -# Dockerfiles for building -/Dockerfile - # IntelliJ IDEA .idea diff --git a/Makefile b/Makefile index f01ca518d1..b3b16691dd 100644 --- a/Makefile +++ b/Makefile @@ -4,6 +4,7 @@ VERSION = edge TAG = $(VERSION) PREFIX = nginx/nginx-ingress +GOLANG_CONTAINER = golang:1.13 DOCKERFILEPATH = build DOCKERFILE = Dockerfile # note, this can be overwritten e.g. can be DOCKERFILE=DockerFileForPlus @@ -12,7 +13,7 @@ PUSH_TO_GCR = GENERATE_DEFAULT_CERT_AND_KEY = DOCKER_BUILD_OPTIONS = -GIT_COMMIT=$(shell git rev-parse --short HEAD) +GIT_COMMIT = $(shell git rev-parse --short HEAD) export DOCKER_BUILDKIT = 1 @@ -44,7 +45,7 @@ endif container: test verify-codegen binary certificate-and-key ifeq ($(BUILD_IN_CONTAINER),1) - docker build $(DOCKER_BUILD_OPTIONS) --build-arg IC_VERSION=$(VERSION)-$(GIT_COMMIT) --target container -f $(DOCKERFILEPATH)/$(DOCKERFILE) -t $(PREFIX):$(TAG) . + docker build $(DOCKER_BUILD_OPTIONS) --build-arg IC_VERSION=$(VERSION)-$(GIT_COMMIT) --build-arg GIT_COMMIT=$(GIT_COMMIT) --build-arg VERSION=$(VERSION) --build-arg GOLANG_CONTAINER=$(GOLANG_CONTAINER) --target container -f $(DOCKERFILEPATH)/$(DOCKERFILE) -t $(PREFIX):$(TAG) . else docker build $(DOCKER_BUILD_OPTIONS) --build-arg IC_VERSION=$(VERSION)-$(GIT_COMMIT) --target local -f $(DOCKERFILEPATH)/$(DOCKERFILE) -t $(PREFIX):$(TAG) . endif diff --git a/build/Dockerfile b/build/Dockerfile index 1ed800833e..9114a4b6dd 100644 --- a/build/Dockerfile +++ b/build/Dockerfile @@ -1,3 +1,5 @@ +ARG GOLANG_CONTAINER + FROM nginx:1.17.7 AS base # forward nginx access and error logs to stdout and stderr of the ingress @@ -36,7 +38,9 @@ FROM base AS local COPY nginx-ingress / -FROM golang:1.13 AS builder +FROM $GOLANG_CONTAINER AS builder +ARG VERSION +ARG GIT_COMMIT WORKDIR /go/src/github.com/nginxinc/kubernetes-ingress/nginx-ingress/cmd/nginx-ingress COPY . /go/src/github.com/nginxinc/kubernetes-ingress/nginx-ingress/ RUN CGO_ENABLED=0 GOFLAGS='-mod=vendor' \ diff --git a/build/DockerfileForAlpine b/build/DockerfileForAlpine index fa20800129..2dd50fee19 100644 --- a/build/DockerfileForAlpine +++ b/build/DockerfileForAlpine @@ -1,3 +1,5 @@ +ARG GOLANG_CONTAINER + FROM nginx:1.17.7-alpine AS base # forward nginx access and error logs to stdout and stderr of the ingress @@ -35,7 +37,9 @@ FROM base AS local COPY nginx-ingress / -FROM golang:1.13 AS builder +FROM $GOLANG_CONTAINER AS builder +ARG VERSION +ARG GIT_COMMIT WORKDIR /go/src/github.com/nginxinc/kubernetes-ingress/nginx-ingress/cmd/nginx-ingress COPY . /go/src/github.com/nginxinc/kubernetes-ingress/nginx-ingress/ RUN CGO_ENABLED=0 GOFLAGS='-mod=vendor' \ diff --git a/build/DockerfileForPlus b/build/DockerfileForPlus index 434229d74a..a78b733257 100644 --- a/build/DockerfileForPlus +++ b/build/DockerfileForPlus @@ -1,3 +1,5 @@ +ARG GOLANG_CONTAINER + FROM debian:stretch-slim AS base LABEL maintainer="NGINX Docker Maintainers " @@ -77,7 +79,9 @@ FROM base AS local COPY nginx-ingress / -FROM golang:1.13 AS builder +FROM $GOLANG_CONTAINER AS builder +ARG VERSION +ARG GIT_COMMIT WORKDIR /go/src/github.com/nginxinc/kubernetes-ingress/nginx-ingress/cmd/nginx-ingress COPY . /go/src/github.com/nginxinc/kubernetes-ingress/nginx-ingress/ RUN CGO_ENABLED=0 GOFLAGS='-mod=vendor' \ diff --git a/build/DockerfileWithOpentracing b/build/DockerfileWithOpentracing index ccbeb14dc5..fa58a678dd 100644 --- a/build/DockerfileWithOpentracing +++ b/build/DockerfileWithOpentracing @@ -1,5 +1,6 @@ ARG NGINX_VERSION=1.17.7 ARG OPENTRACING_CPP_VERSION=1.5.1 +ARG GOLANG_CONTAINER FROM nginx:${NGINX_VERSION} AS opentracing-builder ARG OPENTRACING_CPP_VERSION @@ -102,7 +103,9 @@ FROM base AS local COPY nginx-ingress / -FROM golang:1.13 AS builder +FROM $GOLANG_CONTAINER AS builder +ARG VERSION +ARG GIT_COMMIT WORKDIR /go/src/github.com/nginxinc/kubernetes-ingress/nginx-ingress/cmd/nginx-ingress COPY . /go/src/github.com/nginxinc/kubernetes-ingress/nginx-ingress/ RUN CGO_ENABLED=0 GOFLAGS='-mod=vendor' \ diff --git a/build/DockerfileWithOpentracingForPlus b/build/DockerfileWithOpentracingForPlus index 8e4cd58103..dc94581dd8 100644 --- a/build/DockerfileWithOpentracingForPlus +++ b/build/DockerfileWithOpentracingForPlus @@ -14,6 +14,7 @@ ENV NGINX_PLUS_VERSION 20-1~stretch ENV NGINX_OPENTRACING_MODULE_VERSION 20+0.9.0-1~stretch ARG IC_VERSION +ARG GOLANG_CONTAINER # Download certificate and key from the customer portal (https://cs.nginx.com) # and copy to the build context @@ -94,6 +95,8 @@ COPY nginx-ingress / FROM golang:1.13 AS builder +ARG VERSION +ARG GIT_COMMIT WORKDIR /go/src/github.com/nginxinc/kubernetes-ingress/nginx-ingress/cmd/nginx-ingress COPY . /go/src/github.com/nginxinc/kubernetes-ingress/nginx-ingress/ RUN CGO_ENABLED=0 GOFLAGS='-mod=vendor' \ diff --git a/docs-web/installation/building-ingress-controller-image.md b/docs-web/installation/building-ingress-controller-image.md index e1c129cbaa..0b9f156163 100644 --- a/docs-web/installation/building-ingress-controller-image.md +++ b/docs-web/installation/building-ingress-controller-image.md @@ -53,8 +53,8 @@ Next you will find the details about available Makefile targets and variables. ### Makefile Targets The **Makefile** we provide has the following targets: -* **test**: runs unit tests. -* **binary**: creates the controller binary. +* **test**: runs unit tests (ignored when `BUILD_IN_CONTAINER` is `1`). +* **binary**: creates the controller binary using local golang environment (ignored when `BUILD_IN_CONTAINER` is `1`). * **container**: builds a Docker image. * **push**: pushes the image to the private Docker registry. * **all** (the default target): executes the four targets above in the order listed. If one of the targets fails, the execution process stops, reporting an error. From 71e02aff519ccdf5724c9b2adb9587fc432f705b Mon Sep 17 00:00:00 2001 From: Dean Coakley Date: Fri, 24 Jan 2020 17:50:40 +0000 Subject: [PATCH 20/21] Add golang:latest default for jenkins --- build/Dockerfile | 2 +- build/DockerfileForAlpine | 2 +- build/DockerfileForPlus | 2 +- build/DockerfileWithOpentracing | 2 +- build/DockerfileWithOpentracingForPlus | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/build/Dockerfile b/build/Dockerfile index 9114a4b6dd..b22ab0dcb7 100644 --- a/build/Dockerfile +++ b/build/Dockerfile @@ -1,4 +1,4 @@ -ARG GOLANG_CONTAINER +ARG GOLANG_CONTAINER=golang:latest FROM nginx:1.17.7 AS base diff --git a/build/DockerfileForAlpine b/build/DockerfileForAlpine index 2dd50fee19..2da87e7d0d 100644 --- a/build/DockerfileForAlpine +++ b/build/DockerfileForAlpine @@ -1,4 +1,4 @@ -ARG GOLANG_CONTAINER +ARG GOLANG_CONTAINER=golang:latest FROM nginx:1.17.7-alpine AS base diff --git a/build/DockerfileForPlus b/build/DockerfileForPlus index a78b733257..d681c3b352 100644 --- a/build/DockerfileForPlus +++ b/build/DockerfileForPlus @@ -1,4 +1,4 @@ -ARG GOLANG_CONTAINER +ARG GOLANG_CONTAINER=golang:latest FROM debian:stretch-slim AS base diff --git a/build/DockerfileWithOpentracing b/build/DockerfileWithOpentracing index fa58a678dd..1bce08c223 100644 --- a/build/DockerfileWithOpentracing +++ b/build/DockerfileWithOpentracing @@ -1,6 +1,6 @@ ARG NGINX_VERSION=1.17.7 ARG OPENTRACING_CPP_VERSION=1.5.1 -ARG GOLANG_CONTAINER +ARG GOLANG_CONTAINER=golang:latest FROM nginx:${NGINX_VERSION} AS opentracing-builder ARG OPENTRACING_CPP_VERSION diff --git a/build/DockerfileWithOpentracingForPlus b/build/DockerfileWithOpentracingForPlus index dc94581dd8..f6228538a9 100644 --- a/build/DockerfileWithOpentracingForPlus +++ b/build/DockerfileWithOpentracingForPlus @@ -14,7 +14,7 @@ ENV NGINX_PLUS_VERSION 20-1~stretch ENV NGINX_OPENTRACING_MODULE_VERSION 20+0.9.0-1~stretch ARG IC_VERSION -ARG GOLANG_CONTAINER +ARG GOLANG_CONTAINER=golang:latest # Download certificate and key from the customer portal (https://cs.nginx.com) # and copy to the build context From ecc5245d089067fbcfb182bea0a409114e197ed4 Mon Sep 17 00:00:00 2001 From: Dean Coakley Date: Sat, 25 Jan 2020 00:50:59 +0000 Subject: [PATCH 21/21] Fix typo in opentracing build --- build/DockerfileWithOpentracingForPlus | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/build/DockerfileWithOpentracingForPlus b/build/DockerfileWithOpentracingForPlus index f6228538a9..ff5b80ac3c 100644 --- a/build/DockerfileWithOpentracingForPlus +++ b/build/DockerfileWithOpentracingForPlus @@ -1,3 +1,5 @@ +ARG GOLANG_CONTAINER=golang:latest + FROM debian:stretch-slim AS tracer-downloader ARG JAEGER_VERSION=v0.4.2 @@ -14,7 +16,6 @@ ENV NGINX_PLUS_VERSION 20-1~stretch ENV NGINX_OPENTRACING_MODULE_VERSION 20+0.9.0-1~stretch ARG IC_VERSION -ARG GOLANG_CONTAINER=golang:latest # Download certificate and key from the customer portal (https://cs.nginx.com) # and copy to the build context @@ -94,7 +95,7 @@ FROM base AS local COPY nginx-ingress / -FROM golang:1.13 AS builder +FROM $GOLANG_CONTAINER AS builder ARG VERSION ARG GIT_COMMIT WORKDIR /go/src/github.com/nginxinc/kubernetes-ingress/nginx-ingress/cmd/nginx-ingress