-
Notifications
You must be signed in to change notification settings - Fork 2
/
Dockerfile
103 lines (94 loc) · 3.78 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
# syntax=docker/dockerfile:1
FROM ghcr.io/jvde-github/ais-catcher:edge AS build
FROM ghcr.io/sdr-enthusiasts/docker-baseimage:rtlsdr
ARG TARGETPLATFORM TARGETOS TARGETARCH
ENV S6_KILL_FINISH_MAXTIME=10000 \
UPDATE_PLUGINS=true
SHELL ["/bin/bash", "-o", "pipefail", "-c"]
RUN set -x && \
#
echo "TARGETPLATFORM $TARGETPLATFORM" && \
echo "TARGETOS $TARGETOS" && \
echo "TARGETARCH $TARGETARCH" && \
#
# define required packages
TEMP_PACKAGES=() && \
KEPT_PACKAGES=() && \
SX_PACKAGES=() && \
#
SX_PACKAGES+=(sxfeeder:armhf) && \
# SX_PACKAGES+=(aiscatcher:armhf) && \
#
TEMP_PACKAGES+=(gnupg) && \
if [ "${TARGETARCH:0:3}" != "arm" ]; then KEPT_PACKAGES+=(qemu-user-static); fi && \
#
#KEPT_PACKAGES+=(librtlsdr0) && \
KEPT_PACKAGES+=(libairspy0) && \
KEPT_PACKAGES+=(libhackrf0) && \
KEPT_PACKAGES+=(libzmq5) && \
KEPT_PACKAGES+=(libsoxr0) && \
# KEPT_PACKAGES+=(libcurl4) && \
KEPT_PACKAGES+=(libssl3) && \
KEPT_PACKAGES+=(tcpdump) && \
KEPT_PACKAGES+=(git) && \
KEPT_PACKAGES+=(nano) && \
KEPT_PACKAGES+=(libpqxx-dev) && \
KEPT_PACKAGES+=(lsb-release) && \
#
# install packages
apt-get update && \
apt-get install -q -o Dpkg::Options::="--force-confnew" -y --no-install-recommends --no-install-suggests \
"${KEPT_PACKAGES[@]}" \
"${TEMP_PACKAGES[@]}" \
&& \
#
# install shipfeeder packages
apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 1D043681 && \
echo 'deb https://apt.rb24.com/ bullseye main' > /etc/apt/sources.list.d/rb24.list && \
#
if [ "$TARGETPLATFORM" != "linux/arm/v7" ]; then \
dpkg --add-architecture armhf; \
fi && \
#
# The lines below would allow the apt.rb24.com repo to be access insecurely. We were using this because their key had expired
# However, as of 1-feb-2024, the repo was updated to contain again a valid key so this is no longer needed. Leaving it in as an archifact for future reference.
# apt-get update -q --allow-insecure-repositories && \
# apt-get install -q -o Dpkg::Options::="--force-confnew" -y --no-install-recommends --no-install-suggests --allow-unauthenticated \
# "${SX_PACKAGES[@]}"; \
apt-get update -q && \
apt-get install -q -o Dpkg::Options::="--force-confnew" -y --no-install-recommends --no-install-suggests \
"${SX_PACKAGES[@]}" && \
#
# Do some other stuff
echo "alias dir=\"ls -alsv\"" >> /root/.bashrc && \
echo "alias nano=\"nano -l\"" >> /root/.bashrc && \
#
# clean up
if [[ "${#TEMP_PACKAGES[@]}" -gt 0 ]]; then \
apt-get remove -y "${TEMP_PACKAGES[@]}"; \
fi && \
apt-get autoremove -y && \
# delete unnecessary qemu binaries to save lots of space
{ find /usr/bin -regex '/usr/bin/qemu-.*-static' | grep -v qemu-arm-static | xargs rm -vf {} || true; } && \
rm -rf /src/* /tmp/* /var/lib/apt/lists/*
# add AIS-catcher and libairspyhf
RUN \
--mount=type=bind,from=build,source=/,target=/build/ \
set -x && \
cp -v /build/usr/local/bin/AIS-catcher /usr/local/bin/AIS-catcher && \
find /build | grep libairspyhf | cut -d/ --complement -f1,2 | xargs --replace cp -a -T -v /build/'{}' /'{}' && \
ldconfig && \
true
# Add Container Version
RUN set -x && \
pushd /tmp && \
branch="##BRANCH##" && \
{ [[ "${branch:0:1}" == "#" ]] && branch="main" || true; } && \
git clone --depth=1 -b "$branch" https://github.com/sdr-enthusiasts/docker-shipfeeder.git && \
cd docker-shipfeeder && \
echo "$(TZ=UTC date +%Y%m%d-%H%M%S)_$(git rev-parse --short HEAD)_$(git branch --show-current)" > "/.CONTAINER_VERSION" && \
popd && \
rm -rf /tmp/*
COPY rootfs/ /
# Add healthcheck
HEALTHCHECK --start-period=60s --interval=120s --timeout=100s CMD /healthcheck/healthcheck.sh