ingress-nginx-helm/images/test-runner/rootfs/Dockerfile

142 lines
4.4 KiB
Docker
Raw Normal View History

2018-07-06 03:23:27 +00:00
# Copyright 2018 The Kubernetes Authors. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
2020-06-25 01:14:40 +00:00
ARG BASE_IMAGE
ARG GOLANG_VERSION
ARG ETCD_VERSION
FROM golang:${GOLANG_VERSION}-alpine3.20 as GO
FROM registry.k8s.io/etcd:${ETCD_VERSION} as etcd
2020-06-25 01:14:40 +00:00
FROM ${BASE_IMAGE}
ARG RESTY_CLI_VERSION
ARG RESTY_CLI_SHA
ARG LUAROCKS_VERSION
ARG LUAROCKS_SHA
ARG TARGETARCH
ARG K8S_RELEASE
ARG CHART_TESTING_VERSION
ARG HELM_VERSION
ARG YAMALE_VERSION
ARG YAML_LINT_VERSION
ARG GINKGO_VERSION
ARG GOLINT_VERSION
RUN set -eux; \
if [ -e /etc/nsswitch.conf ]; then \
grep '^hosts: files dns' /etc/nsswitch.conf; \
else \
echo 'hosts: files dns' > /etc/nsswitch.conf; \
fi
2020-06-02 01:22:32 +00:00
COPY --from=GO /usr/local/go /usr/local/go
ENV GOPATH /go
ENV PATH $GOPATH/bin:/usr/local/go/bin:$PATH
RUN mkdir -p "$GOPATH/src" "$GOPATH/bin" && chmod -R 777 "$GOPATH"
2020-06-02 01:22:32 +00:00
COPY --from=etcd /usr/local/bin/etcd /usr/local/bin/etcd
2020-05-31 03:25:56 +00:00
RUN echo "@testing https://dl-cdn.alpinelinux.org/alpine/edge/testing" >> /etc/apk/repositories
2020-09-02 16:23:08 +00:00
RUN apk update && apk upgrade && apk add --no-cache \
2020-01-04 23:29:49 +00:00
bash \
ca-certificates \
wget \
make \
gcc \
git \
musl-dev \
2020-01-27 00:48:35 +00:00
perl \
2020-10-29 18:14:33 +00:00
python3 \
2020-02-26 19:52:31 +00:00
py-crcmod \
py-pip \
2020-05-31 03:25:56 +00:00
unzip \
2020-09-02 16:23:08 +00:00
openssl \
cfssl@testing \
tzdata \
libc6-compat \
sqlite-dev
2020-05-31 03:25:56 +00:00
RUN go install -v github.com/onsi/ginkgo/v2/ginkgo@v${GINKGO_VERSION} \
&& go install golang.org/x/lint/golint@${GOLINT_VERSION}
2020-06-25 01:14:40 +00:00
RUN wget -qO /tmp/resty_cli.tgz \
2020-06-25 01:14:40 +00:00
https://github.com/openresty/resty-cli/archive/v${RESTY_CLI_VERSION}.tar.gz \
2020-05-31 03:25:56 +00:00
&& echo "${RESTY_CLI_SHA} */tmp/resty_cli.tgz" | sha256sum -c - \
&& tar -C /tmp -xzf /tmp/resty_cli.tgz \
&& mv /tmp/resty-cli-${RESTY_CLI_VERSION}/bin/* /usr/local/bin/ \
&& resty -V \
&& rm -rf /tmp/*
RUN wget -qO /tmp/luarocks.tgz \
2020-06-25 01:14:40 +00:00
https://github.com/luarocks/luarocks/archive/v${LUAROCKS_VERSION}.tar.gz \
&& echo "${LUAROCKS_SHA} */tmp/luarocks.tgz" | sha256sum -c - \
2020-05-31 03:25:56 +00:00
&& tar -C /tmp -xzf /tmp/luarocks.tgz \
&& cd /tmp/luarocks* \
&& ./configure \
&& make install
2020-06-02 01:22:32 +00:00
RUN luarocks install busted \
2020-05-31 03:25:56 +00:00
&& luarocks install luacheck
RUN wget -qO /usr/local/bin/kubectl \
https://dl.k8s.io/release/${K8S_RELEASE}/bin/linux/${TARGETARCH}/kubectl \
&& chmod +x /usr/local/bin/kubectl
2019-05-24 00:47:14 +00:00
RUN wget -qO /usr/local/bin/kube-apiserver \
https://dl.k8s.io/release/${K8S_RELEASE}/bin/linux/${TARGETARCH}/kube-apiserver \
2019-05-24 00:47:14 +00:00
&& chmod +x /usr/local/bin/kube-apiserver
RUN wget -qO /tmp/ct-${CHART_TESTING_VERSION}-linux-${TARGETARCH}.tar.gz \
https://github.com/helm/chart-testing/releases/download/v${CHART_TESTING_VERSION}/chart-testing_${CHART_TESTING_VERSION}_linux_${TARGETARCH}.tar.gz \
2020-02-26 19:52:31 +00:00
&& mkdir -p /tmp/ct-download \
&& tar xzvf /tmp/ct-${CHART_TESTING_VERSION}-linux-${TARGETARCH}.tar.gz -C /tmp/ct-download \
&& rm /tmp/ct-${CHART_TESTING_VERSION}-linux-${TARGETARCH}.tar.gz \
2020-02-26 19:52:31 +00:00
&& cp /tmp/ct-download/ct /usr/local/bin \
&& mkdir -p /etc/ct \
&& cp -R /tmp/ct-download/etc/* /etc/ct \
2020-05-31 03:25:56 +00:00
&& rm -rf /tmp/*
RUN wget -qO /usr/local/bin/lj-releng \
2020-06-25 01:14:40 +00:00
https://raw.githubusercontent.com/openresty/openresty-devel-utils/master/lj-releng \
2020-05-31 19:35:55 +00:00
&& chmod +x /usr/local/bin/lj-releng
2020-02-26 19:52:31 +00:00
RUN wget -qO /tmp/helm.tgz \
https://get.helm.sh/helm-v${HELM_VERSION}-linux-${TARGETARCH}.tar.gz \
2020-05-31 03:25:56 +00:00
&& tar -C /tmp -xzf /tmp/helm.tgz \
&& cp /tmp/linux*/helm /usr/local/bin \
&& rm -rf /tmp/*
2020-02-26 19:52:31 +00:00
2020-05-31 03:25:56 +00:00
# Install a YAML Linter
# Pip not working. Check PR https://github.com/kubernetes/ingress-nginx/pull/10874
# RUN pip install --user "yamllint==$YAML_LINT_VERSION"
RUN apk update -U \
&& apk add yamllint \
&& yamllint --version
2020-05-31 03:25:56 +00:00
# Install Yamale YAML schema validator
# Commenting pip install yamale because broken cloudbuild https://github.com/kubernetes/ingress-nginx/pull/10885
# RUN pip install --user "yamale==$YAMALE_VERSION"
RUN wget https://github.com/23andMe/Yamale/archive/master.zip \
&& unzip -d /tmp master.zip \
&& cd /tmp/Yamale-master \
&& python setup.py install \
&& yamale -V
2020-05-31 03:25:56 +00:00
LABEL org.opencontainers.image.source=https://github.com/kubernetes/ingress-nginx
2020-01-04 23:29:49 +00:00
WORKDIR $GOPATH