Merge "Update sonobuoy kube-conformance docker images"
[validation.git] / docker / k8s / Dockerfile
1 ##############################################################################
2 # Copyright (c) 2019 AT&T, ENEA AB, Nokia and others                         #
3 #                                                                            #
4 # Licensed under the Apache License, Version 2.0 (the "License");            #
5 # you maynot use this file except in compliance with the License.            #
6 #                                                                            #
7 # You may obtain a copy of the License at                                    #
8 #       http://www.apache.org/licenses/LICENSE-2.0                           #
9 #                                                                            #
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 ##############################################################################
16
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
19
20 # Sonobuoy supports 3 Kubernetes minor versions: the current release and 2
21 # minor versions before.
22 ARG SB_TAG=v0.16.1
23 # Determine the latest stable git tag at build time based on stable major version
24 ARG K8S_VER=1.18
25
26 # Install dependencies
27 COPY pip-requirements.txt /wheels/requirements/pip-requirements.txt
28
29 RUN apk --no-cache add --update \
30         bash \
31         build-base \
32         cairo \
33         cairo-dev \
34         cargo \
35         curl \
36         findutils \
37         freetype-dev \
38         gcc \
39         gdk-pixbuf-dev \
40         gettext \
41         git \
42         grep \
43         jpeg-dev \
44         lcms2-dev \
45         libc-dev \
46         libffi-dev \
47         make \
48         musl-dev \
49         openjpeg-dev \
50         openssl-dev \
51         pango-dev \
52         poppler-utils \
53         postgresql-client \
54         postgresql-dev \
55         py-cffi \
56         python3-dev \
57         py3-pip \
58         rsync \
59         rust \
60         tcl-dev \
61         tiff-dev \
62         tk-dev \
63         zlib-dev
64
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 && \
70     git checkout $(curl \
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 && \
76     pwd \
77     git checkout $SB_TAG && \
78     go install
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
82
83 WORKDIR /wheels
84 RUN pip3 install wheel
85 RUN pip3 wheel -r /wheels/requirements/pip-requirements.txt
86
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/
93
94 RUN apk --no-cache add --update \
95         bash \
96         build-base \
97         cairo \
98         cairo-dev \
99         cargo \
100         curl \
101         findutils \
102         freetype-dev \
103         gcc \
104         gdk-pixbuf-dev \
105         gettext \
106         git \
107         grep \
108         jpeg-dev \
109         lcms2-dev \
110         libc-dev \
111         libffi-dev \
112         make \
113         musl-dev \
114         openjpeg-dev \
115         openssl-dev \
116         pango-dev \
117         poppler-utils \
118         postgresql-client \
119         postgresql-dev \
120         py-cffi \
121         python3-dev \
122         py3-pip \
123         rsync \
124         rust \
125         tcl-dev \
126         tiff-dev \
127         tk-dev \
128         zlib-dev
129
130 RUN pip3 install -r /wheels/requirements/pip-requirements.txt \
131                  -f /wheels && \
132      rm -rf /wheels && \
133      rm -rf /root/.cache/pip/*