File tree Expand file tree Collapse file tree 2 files changed +68
-9
lines changed Expand file tree Collapse file tree 2 files changed +68
-9
lines changed Original file line number Diff line number Diff line change
1
+ FROM debian:stable-slim as fetcher
2
+ COPY build/fetch_binaries.sh /tmp/fetch_binaries.sh
3
+
4
+ RUN apt-get update && apt-get install -y \
5
+ curl \
6
+ wget
7
+
8
+ RUN /tmp/fetch_binaries.sh
9
+
1
10
FROM alpine:3.9
2
11
3
12
RUN set -ex \
@@ -57,19 +66,13 @@ RUN set -ex \
57
66
RUN mv /usr/sbin/tcpdump /usr/bin/tcpdump
58
67
59
68
# Installing ctop - top-like container monitor
60
- RUN wget https://github.com/bcicen/ctop/releases/download/v0.7.1/ctop-0.7.1-linux-amd64 -O /usr/local/bin/ ctop && chmod +x /usr/local/bin/ctop
69
+ COPY --from=fetcher /tmp/ ctop /usr/local/bin/ctop
61
70
62
71
# Installing calicoctl
63
- ARG CALICOCTL_VERSION=v3.13.3
64
- RUN wget https://github.com/projectcalico/calicoctl/releases/download/${CALICOCTL_VERSION}/calicoctl && chmod +x calicoctl && mv calicoctl /usr/local/bin
72
+ COPY --from=fetcher /tmp/calicoctl /usr/local/bin/calicoctl
65
73
66
74
# Installing termshark
67
- ENV TERMSHARK_VERSION 2.1.1
68
- RUN wget https://github.com/gcla/termshark/releases/download/v${TERMSHARK_VERSION}/termshark_${TERMSHARK_VERSION}_linux_x64.tar.gz -O /tmp/termshark_${TERMSHARK_VERSION}_linux_x64.tar.gz && \
69
- tar -zxvf /tmp/termshark_${TERMSHARK_VERSION}_linux_x64.tar.gz && \
70
- mv termshark_${TERMSHARK_VERSION}_linux_x64/termshark /usr/local/bin/termshark && \
71
- chmod +x /usr/local/bin/termshark
72
-
75
+ COPY --from=fetcher /tmp/termshark /usr/local/bin/termshark
73
76
74
77
# Settings
75
78
ADD motd /etc/motd
Original file line number Diff line number Diff line change
1
+ #! /usr/bin/env bash
2
+ set -euo pipefail
3
+
4
+ get_latest_release () {
5
+ curl --silent " https://api.github.com/repos/$1 /releases/latest" | # Get latest release from GitHub api
6
+ grep ' "tag_name":' | # Get tag line
7
+ sed -E ' s/.*"([^"]+)".*/\1/' # Pluck JSON value
8
+ }
9
+
10
+
11
+ ARCH=$( uname -m)
12
+ case $ARCH in
13
+ x86_64)
14
+ ARCH=amd64
15
+ ;;
16
+ aarch64)
17
+ ARCH=arm64
18
+ ;;
19
+ esac
20
+
21
+ get_ctop () {
22
+ VERSION=$( get_latest_release bcicen/ctop | sed -e ' s/^v//' )
23
+ LINK=" https://github.com/bcicen/ctop/releases/download/v${VERSION} /ctop-${VERSION} -linux-${ARCH} "
24
+ wget " $LINK " -O /tmp/ctop && chmod +x /tmp/ctop
25
+ }
26
+
27
+ get_calicoctl () {
28
+ VERSION=$( get_latest_release projectcalico/calicoctl)
29
+ LINK=" https://github.com/projectcalico/calicoctl/releases/download/${VERSION} /calicoctl-linux-${ARCH} "
30
+ wget " $LINK " -O /tmp/calicoctl && chmod +x /tmp/calicoctl
31
+ }
32
+
33
+ get_termshark () {
34
+ case " $ARCH " in
35
+ " arm" * )
36
+ echo " echo termshark does not yet support arm" > /tmp/termshark && chmod +x /tmp/termshark
37
+ ;;
38
+ * )
39
+ VERSION=$( get_latest_release gcla/termshark | sed -e ' s/^v//' )
40
+ if [ " $ARCH " == " amd64" ]; then
41
+ TERM_ARCH=x64
42
+ else
43
+ TERM_ARCH=" $ARCH "
44
+ fi
45
+ LINK=" https://github.com/gcla/termshark/releases/download/v${VERSION} /termshark_${VERSION} _linux_${TERM_ARCH} .tar.gz"
46
+ wget " $LINK " -O /tmp/termshark.tar.gz && \
47
+ tar -zxvf /tmp/termshark.tar.gz && \
48
+ mv " termshark_${VERSION} _linux_${TERM_ARCH} /termshark" /tmp/termshark && \
49
+ chmod +x /tmp/termshark
50
+ ;;
51
+ esac
52
+ }
53
+
54
+ get_ctop
55
+ get_calicoctl
56
+ get_termshark
You can’t perform that action at this time.
0 commit comments