-
Notifications
You must be signed in to change notification settings - Fork 3
/
Dockerfile
98 lines (72 loc) · 2.31 KB
/
Dockerfile
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
# syntax=docker/dockerfile:1.4
#
# meta arguments
#
# build 0: specification of base version
ARG NDT_BUILDER_VERSION=1.18
# build 1: set app in builder
ARG APP_NAME=netrics
ARG ORG_NAME=internet-equity
# build 1: specification of builder version
ARG BUILDER_VERSION=latest
#
# build 0: build ndt7 client
#
FROM golang:${NDT_BUILDER_VERSION} AS ndt7-build
ARG NDT_CLIENT_VERSION=0.8.0
RUN <<PKG-CONF
#!/bin/bash
set -euo pipefail
# ensure apt caching configuration for (future) PKG-INSTALL stanza(s)
rm -f /etc/apt/apt.conf.d/docker-clean
cat << KEEP-CACHE > /etc/apt/apt.conf.d/keep-cache
Binary::apt::APT::Keep-Downloaded-Packages "true";
KEEP-CACHE
PKG-CONF
RUN --mount=type=cache,target=/var/cache/apt,sharing=locked \
--mount=type=cache,target=/var/lib/apt,sharing=locked <<PKG-INSTALL
#!/bin/bash
export DEBIAN_FRONTEND=noninteractive
set -euo pipefail
apt update
apt upgrade --yes
PKG-INSTALL
RUN <<NDT7-BUILD
#!/bin/bash
set -euo pipefail
curl --silent --location https://github.com/m-lab/ndt7-client-go/archive/v${NDT_CLIENT_VERSION}.tar.gz | tar -zxf -
cd ndt7-client-go-${NDT_CLIENT_VERSION}
env GO111MODULE=on go install ./cmd/ndt7-client
NDT7-BUILD
#
# build 1: netrics
#
FROM ghcr.io/internet-equity/fate-builder:${BUILDER_VERSION}
RUN --mount=type=cache,target=/var/cache/apt,sharing=locked \
--mount=type=cache,target=/var/lib/apt,sharing=locked <<PKG-INSTALL
#!/usr/bin/bash
export DEBIAN_FRONTEND=noninteractive
set -euo pipefail
#
# cache of /var/lib/apt -- though populated in *this* build by builder's ONBUILD instructions --
# may not function correctly and we must assume that it *may* be empty.
#
# as such, we'll use this cache -- hoping that, when it's used, it'll speed up operations, at
# the same time as it keeps these files *out* of the image itself -- but we'll *ensure* that
# the directory is populated (by "update") *here*
#
apt update
# (the speedtest-cli script runs "update" ... but not *consistently* prior to some of its
# "install" commands)
curl --silent https://packagecloud.io/install/repositories/ookla/speedtest-cli/script.deb.sh | bash
apt install --yes --no-install-recommends \
bind9-dnsutils \
iputils-ping \
net-tools \
nmap \
scamper \
speedtest \
traceroute
PKG-INSTALL
COPY --from=ndt7-build /go/bin/ndt7-client /usr/local/bin/
CMD ["netrics.d", "--foreground"]