-
Notifications
You must be signed in to change notification settings - Fork 41
/
TestDockerfile
99 lines (84 loc) · 3.41 KB
/
TestDockerfile
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
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
# TestDockerfile for running ndt-server integration tests.
#
# BUILD STEPS:
# * Setup a base build environment based on the same image as the final image.
# * Build libndt, measurement-kit, ndtrawjson, ndtrawnojson clients
# * Setup the final image by copying clients.
#
# Because client binaries are dynamically linked, the versions must be
# available during build and in the final image. The simplest way to guarantee
# that is to use the same base image.
# A base image for building and the final image.
# NOTE: use debian based golang image to easily access libraries and development
# packages that are unavailable or harder to setup in alpine-based images.
FROM golang:1.18-buster as ndtbase
WORKDIR /
RUN apt-get update && apt-get install -y git libmaxminddb0 libevent-2.1-6 \
libevent-core-2.1-6 libevent-extra-2.1-6 \
libevent-openssl-2.1-6 libevent-pthreads-2.1-6
# A base image for building clients.
FROM ndtbase AS ndtbuild
WORKDIR /
RUN apt-get update && apt-get install -y build-essential autotools-dev \
automake zlib1g-dev cmake libssl-dev libcurl4-openssl-dev \
libmaxminddb-dev libevent-dev libtool-bin libtool
RUN git clone --recursive https://github.com/m-lab/ndt/
# Build a libndt client.
FROM ndtbuild AS libndt
RUN git clone --recursive https://github.com/measurement-kit/libndt
WORKDIR /libndt
RUN cmake .
RUN cmake --build .
# Build a measurement_kit client.
FROM ndtbuild AS mk
RUN git clone https://github.com/measurement-kit/measurement-kit.git
WORKDIR /measurement-kit
RUN ./autogen.sh
RUN ./configure
RUN make -j 8
RUN make -j 8 install
# Build a version of web100clt that uses JSON.
FROM ndtbuild as ndtrawjson
RUN apt-get install -y libjansson-dev
WORKDIR /ndt
RUN ./bootstrap
RUN ./configure --enable-static
WORKDIR /ndt/src
RUN make -j 8 web100clt
# Build a version of web100clt that does not use JSON.
FROM ndtbuild AS ndtrawnojson
# I2util used to be a separate library, so make sure to install it from the
# modern NDT repo before we back up to a super-old code version that expects it
# to be installed separately.
WORKDIR /ndt/I2util
RUN ./bootstrap.sh
RUN ./configure
RUN make -j 8 install
WORKDIR /ndt
# Check out a build from before JSON support was in the binary. Because
# libjansson is not installed in this image, if the build succeeds, then it
# does not use JSON.
RUN git checkout 1f918aa4411c5bd3a863127b58bbd3b75c9d8a09
RUN ./bootstrap
RUN ./configure --enable-static
WORKDIR /ndt/src
RUN make -j 8 web100clt
# Build the final image in which the server will be tested.
FROM ndtbase AS final
COPY --from=ndtrawjson /ndt/src/web100clt /bin/web100clt-with-json-support
COPY --from=ndtrawnojson /ndt/src/web100clt /bin/web100clt-without-json-support
COPY --from=libndt /libndt/libndt-client /bin/libndt-client
COPY --from=mk /usr/local/bin/measurement_kit /bin/measurement_kit
RUN curl -sL https://deb.nodesource.com/setup_10.x | bash -
RUN apt-get update && apt-get install -y nodejs libjansson4 libssl1.1 libssl1.0
ENV GOPATH=/go
RUN go install github.com/mattn/goveralls@latest
ADD . /go/src/github.com/m-lab/ndt-server
RUN go install github.com/m-lab/ndt7-client-go/cmd/ndt7-client@latest
WORKDIR /go/src/github.com/m-lab/ndt-server/testdata
RUN npm install .
WORKDIR /go/src/github.com/m-lab/ndt-server
RUN ./build.sh
CMD /bin/bash ./test.sh
# To build everything and run unit and integration tests, we recommend a commandline like:
# docker build -f TestDockerfile . -t ndttest && docker run -it ndttest