1 ##############################################################################
2 # Copyright (c) 2019 AT&T, ENEA AB, Nokia and others #
4 # Licensed under the Apache License, Version 2.0 (the "License"); #
5 # you maynot use this file except in compliance with the License. #
7 # You may obtain a copy of the License at #
8 # http://www.apache.org/licenses/LICENSE-2.0 #
10 # Unless required by applicable law or agreed to in writing, software #
11 # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT #
12 # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. #
13 # See the License for the specific language governing permissions and #
14 # limitations under the License. #
15 ##############################################################################
17 # ref: https://docs.docker.com/develop/develop-images/dockerfile_best-practices/#use-multi-stage-builds
18 FROM golang:1.16.5-alpine3.13 as build
20 # Sonobuoy supports 3 Kubernetes minor versions: the current release and 2
21 # minor versions before.
23 # Determine the latest stable git tag at build time based on stable major version
26 # Install dependencies
27 COPY pip-requirements.txt /wheels/requirements/pip-requirements.txt
29 RUN apk --no-cache add --update \
65 # Build binaries; detect the architecture automatically (default is amd64)
66 RUN git clone https://github.com/kubernetes/kubernetes /src/k8s.io/kubernetes
67 RUN if [ $(uname -m) == 'aarch64' ]; then HOST_ARCH=arm64; else HOST_ARCH=amd64; fi && \
68 echo "Building docker on $HOST_ARCH" && \
69 cd /src/k8s.io/kubernetes && \
71 https://storage.googleapis.com/kubernetes-release/release/stable-$K8S_VER.txt) && \
72 make kubectl ginkgo && \
73 make WHAT=test/e2e/e2e.test ARCH=$HOST_ARCH
74 RUN git clone https://github.com/heptio/sonobuoy /go/src/github.com/heptio/sonobuoy && \
75 cd /go/src/github.com/heptio/sonobuoy && \
77 git checkout $SB_TAG && \
79 RUN git clone https://gerrit.akraino.org/r/validation /opt/akraino/validation
80 RUN cat /opt/akraino/validation/bluval/requirements.txt >> \
81 /wheels/requirements/pip-requirements.txt
84 RUN pip3 install wheel
85 RUN pip3 wheel -r /wheels/requirements/pip-requirements.txt
87 # Copy binaries in the final container and install robot framework
88 FROM python:3.10.0b1-alpine3.13
89 COPY --from=build /src/k8s.io/kubernetes/_output/bin /usr/local/bin
90 COPY --from=build /go/bin/sonobuoy /bin/sonobuoy
91 COPY --from=build /wheels /wheels
92 COPY --from=build /opt/akraino/validation/ /opt/akraino/validation/
94 RUN apk --no-cache add --update \
130 RUN pip3 install -r /wheels/requirements/pip-requirements.txt \
133 rm -rf /root/.cache/pip/*