-
Notifications
You must be signed in to change notification settings - Fork 30
/
Dockerfile
137 lines (131 loc) · 5.95 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
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
FROM ghcr.io/sdr-enthusiasts/docker-baseimage:dump978-full
ENV S6_BEHAVIOUR_IF_STAGE2_FAILS=2 \
VERBOSE_LOGGING="false"
SHELL ["/bin/bash", "-o", "pipefail", "-c"]
# hadolint ignore=DL3008,SC2086,SC2039,SC2068
RUN set -x && \
TEMP_PACKAGES=() && \
KEPT_PACKAGES=() && \
# Essentials
TEMP_PACKAGES+=(automake) && \
TEMP_PACKAGES+=(build-essential) && \
TEMP_PACKAGES+=(cmake) && \
TEMP_PACKAGES+=(git) && \
TEMP_PACKAGES+=(pkg-config) && \
# s6-overlay dependencies
TEMP_PACKAGES+=(gnupg2) && \
TEMP_PACKAGES+=(file) && \
# libusb for a number of things
KEPT_PACKAGES+=(libusb-1.0-0) && \
TEMP_PACKAGES+=(libusb-1.0-0-dev) && \
# dump1090 dependencies
KEPT_PACKAGES+=(libatomic1) && \
KEPT_PACKAGES+=(libncurses6) && \
TEMP_PACKAGES+=(libncurses-dev) && \
# tcllauncher dependencies
KEPT_PACKAGES+=(tcl) && \
TEMP_PACKAGES+=(tcl-dev) && \
KEPT_PACKAGES+=(tcl-tls) && \
KEPT_PACKAGES+=(tclx) && \
# piaware-web dependencies
KEPT_PACKAGES+=(lighttpd) && \
KEPT_PACKAGES+=(lighttpd-mod-deflate) && \
# mlat-client dependencies
KEPT_PACKAGES+=(python3-minimal) && \
KEPT_PACKAGES+=(python3-pkg-resources) && \
TEMP_PACKAGES+=(python3-distutils) && \
TEMP_PACKAGES+=(python3-dev) && \
TEMP_PACKAGES+=(python3-setuptools) && \
# piaware dependencies
KEPT_PACKAGES+=(itcl3) && \
KEPT_PACKAGES+=(tcllib) && \
KEPT_PACKAGES+=(net-tools) && \
KEPT_PACKAGES+=(procps) && \
KEPT_PACKAGES+=(socat) && \
# beast-splitter dependencies
TEMP_PACKAGES+=(libboost1.74-dev) && \
TEMP_PACKAGES+=(libboost-system1.74-dev) && \
KEPT_PACKAGES+=(libboost-system1.74.0) && \
TEMP_PACKAGES+=(libboost-program-options1.74-dev) && \
KEPT_PACKAGES+=(libboost-program-options1.74.0) && \
TEMP_PACKAGES+=(libboost-regex1.74-dev) && \
KEPT_PACKAGES+=(libboost-regex1.74.0) && \
# Install packages.
apt-get update && \
apt-get install -y --no-install-recommends \
${KEPT_PACKAGES[@]} \
${TEMP_PACKAGES[@]} \
&& \
git config --global advice.detachedHead false && \
# Build & install tcllauncher
BRANCH_TCLLAUNCHER=$(git -c 'versionsort.suffix=-' ls-remote --tags --sort='v:refname' 'https://github.com/flightaware/tcllauncher.git' | grep -v '\^' | cut -d '/' -f 3 | grep '^v.*' | tail -1) && \
git clone --depth 1 --branch "$BRANCH_TCLLAUNCHER" "https://github.com/flightaware/tcllauncher.git" "/src/tcllauncher" && \
pushd "/src/tcllauncher" && \
echo "tcllauncher ${BRANCH_TCLLAUNCHER}" >> /VERSIONS && \
autoconf && \
./configure --prefix=/opt/tcl && \
make -j "$(nproc)" && \
make install && \
ldconfig && \
popd && \
# Build & install piaware
BRANCH_PIAWARE=$(git -c 'versionsort.suffix=-' ls-remote --tags --sort='v:refname' 'https://github.com/flightaware/piaware.git' | grep -v '\^' | cut -d '/' -f 3 | grep '^v.*' | tail -1) && \
git clone --depth 1 --branch "$BRANCH_PIAWARE" "https://github.com/flightaware/piaware.git" "/src/piaware" && \
pushd "/src/piaware" && \
echo "piaware ${BRANCH_PIAWARE}" >> /VERSIONS && \
make -j "$(nproc)" install && \
cp -v /src/piaware/package/ca/*.pem /etc/ssl/ && \
touch /etc/piaware.conf && \
mkdir -p /run/piaware && \
ldconfig && \
popd && \
# Build & install piaware-web
git clone "https://github.com/flightaware/piaware-web.git" "/src/piaware-web" && \
cp -Rv /src/piaware-web/web/. /var/www/html/ && \
# Symlink for skyaware978
ln -vs /usr/share/dump978-fa /usr/share/skyaware978 && \
# get dump1090 sources
DUMP1090_VERSION=$(git -c 'versionsort.suffix=-' ls-remote --tags --sort='v:refname' 'https://github.com/flightaware/dump1090.git' | grep -v '\^' | cut -d '/' -f 3 | grep '^v.*' | tail -1) && \
export DUMP1090_VERSION && \
git clone --depth 1 --branch "$DUMP1090_VERSION" "https://github.com/flightaware/dump1090.git" "/src/dump1090" && \
pushd "/src/dump1090" && \
echo "dump1090 ${DUMP1090_VERSION}" >> /VERSIONS && \
make -j "$(nproc)" showconfig RTLSDR=yes && \
make -j "$(nproc)" all RTLSDR=yes -j && \
make -j "$(nproc)" faup1090 RTLSDR=yes -j && \
cp -v view1090 dump1090 /usr/local/bin/ && \
cp -v faup1090 /usr/lib/piaware/helpers/ && \
mkdir -p /usr/share/skyaware/html && \
cp -a /src/dump1090/public_html/* /usr/share/skyaware/html && \
ldconfig && \
popd && \
dump1090 --version && \
# Build & install mlat-client
BRANCH_MLATCLIENT=$(git -c 'versionsort.suffix=-' ls-remote --tags --sort='v:refname' 'https://github.com/mutability/mlat-client.git' | grep -v '\^' | cut -d '/' -f 3 | grep '^v.*' | tail -1) && \
git clone --depth 1 --branch "$BRANCH_MLATCLIENT" "https://github.com/mutability/mlat-client.git" "/src/mlat-client" && \
pushd /src/mlat-client && \
BRANCH_MLATCLIENT="$(git tag --sort='-creatordate' | head -1)" && \
echo "mlat-client ${BRANCH_MLATCLIENT}" >> /VERSIONS && \
./setup.py install && \
ln -s /usr/local/bin/fa-mlat-client /usr/lib/piaware/helpers/ && \
ldconfig && \
popd && \
# Build & install beast-splitter
BRANCH_BEASTSPLITTER=$(git -c 'versionsort.suffix=-' ls-remote --tags --sort='v:refname' 'https://github.com/flightaware/beast-splitter.git' | grep -v '\^' | cut -d '/' -f 3 | grep '^v.*' | tail -1) && \
git clone --depth 1 --branch "$BRANCH_BEASTSPLITTER" "https://github.com/flightaware/beast-splitter.git" "/src/beast-splitter" && \
pushd "/src/beast-splitter" && \
echo "beast-splitter ${BRANCH_BEASTSPLITTER}" >> /VERSIONS && \
make -j "$(nproc)" && \
cp -v ./beast-splitter /usr/local/bin/ && \
popd && \
# Clean up
apt-get autoremove -q -o APT::Autoremove::RecommendsImportant=0 -o APT::Autoremove::SuggestsImportant=0 -y "${TEMP_PACKAGES[@]}" && \
apt-get clean -y && \
# remove pycache
{ find /usr | grep -E "/__pycache__$" | xargs rm -rf || true; } && \
rm -rf /src /tmp/* /var/lib/apt/lists/* /var/log/* /var/cache/* && \
# Store container version
grep piaware /VERSIONS | cut -d " " -f 2 > /IMAGE_VERSION
COPY rootfs/ /
EXPOSE 80/tcp 30003/tcp 30005/tcp 30105/tcp 30978/tcp 30979/tcp
HEALTHCHECK --start-period=7200s --interval=600s CMD /scripts/healthcheck.sh