forked from sdr-enthusiasts/docker-aprs-tracker
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
92 lines (83 loc) · 3.19 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
FROM ghcr.io/sdr-enthusiasts/docker-baseimage:base as gpsd-build
RUN set -x && \
# install packages
KEPT_PACKAGES=() && \
KEPT_PACKAGES+=(gpsd) && \
apt-get update && \
apt-get install -q -o Dpkg::Options::="--force-confnew" -y --no-install-recommends --no-install-suggests \
"${KEPT_PACKAGES[@]}"
FROM ghcr.io/sdr-enthusiasts/docker-baseimage:base as chrony-build
RUN set -x && \
# install packages
KEPT_PACKAGES=() && \
KEPT_PACKAGES+=(chrony) && \
apt-get update && \
apt-get install -q -o Dpkg::Options::="--force-confnew" -y --no-install-recommends --no-install-suggests \
"${KEPT_PACKAGES[@]}"
# Add Container Version
FROM ghcr.io/sdr-enthusiasts/docker-baseimage:base as container-version
RUN set -x && \
KEPT_PACKAGES=() && \
KEPT_PACKAGES+=(git) && \
apt-get update && \
apt-get install -q -o Dpkg::Options::="--force-confnew" -y --no-install-recommends --no-install-suggests \
"${KEPT_PACKAGES[@]}" && \
#
branch="##BRANCH##" && \
[[ "${branch:0:1}" == "#" ]] && branch="main" || true && \
git clone --depth=1 -b $branch https://github.com/sdr-enthusiasts/docker-aprs-tracker.git && \
cd docker-aprs-tracker && \
echo "$(TZ=UTC date +%Y%m%d-%H%M%S)_$(git rev-parse --short HEAD)_$(git branch --show-current)" > /.CONTAINER_VERSION
FROM ghcr.io/sdr-enthusiasts/docker-baseimage:base
LABEL org.opencontainers.image.source="https://github.com/sdr-enthusiasts/docker-aprs-tracker"
# start options presets for GPSD:
ENV GPSD_START_DAEMON="false"
ENV GPSD_OPTIONS="-n"
ENV GPSD_DEVICES="/dev/gps"
ENV GPSD_USBAUTO="true"
ENV GPSD_SOCKET="/var/run/gpsd.sock"
RUN set -x && \
# generic packages
TEMP_PACKAGES=() && \
KEPT_PACKAGES=() && \
KEPT_PACKAGES+=(bc) && \
KEPT_PACKAGES+=(jq) && \
KEPT_PACKAGES+=(git) && \
KEPT_PACKAGES+=(nano) && \
KEPT_PACKAGES+=(curl) && \
# minimum config needed for GPSD:
KEPT_PACKAGES+=(libbluetooth3) && \
# minumum config needed for chrony:
KEPT_PACKAGES+=(iproute2) && \
KEPT_PACKAGES+=(ucf) && \
# packages for direwolf
KEPT_PACKAGES+=(direwolf) && \
KEPT_PACKAGES+=(alsa-utils) && \
#
# 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[@]}" \
&& \
# 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 && \
#
# set CONTAINER_VERSION:
rm -rf /src/* /tmp/* /var/lib/apt/lists/*
COPY --from=gpsd-build /usr/sbin/gpsd /usr/sbin/gpsd
COPY --from=chrony-build /usr/sbin/chronyd /usr/sbin/chronyd
COPY --from=chrony-build /etc/chrony/chrony.keys /etc/chrony/chrony.keys
COPY --from=container-version /.CONTAINER_VERSION /.CONTAINER_VERSION
COPY rootfs/ /
EXPOSE 2947
# Add healthcheck
# HEALTHCHECK --start-period=60s --interval=600s --timeout=60s CMD /healthcheck/healthcheck.sh
SHELL ["/bin/bash", "-o", "pipefail", "-c"]