-
Notifications
You must be signed in to change notification settings - Fork 1
/
Dockerfile
67 lines (61 loc) · 2.45 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
FROM ghcr.io/sdr-enthusiasts/docker-baseimage:base AS build
SHELL ["/bin/bash", "-x", "-o", "pipefail", "-c"]
RUN \
--mount=type=bind,source=./,target=/ghrepo/ \
apt-get update -y && \
apt-get install -q -o Dpkg::Options::="--force-confnew" -y \
git gcc && \
mkdir -p /src && \
cd /src && \
cp -f /ghrepo/src/distance.c . && \
gcc -static distance.c -o distance -lm -Ofast && \
# Add Container Version:
cd / && \
branch="##BRANCH##" && \
{ [[ "${branch:0:1}" == "#" ]] && branch="main" || true; } && \
git clone --depth=1 -b $branch https://github.com/sdr-enthusiasts/docker-vesselalert.git && \
cd docker-vesselalert && \
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
ENV MASTODON_NOTIFY_EVERY=86400
ENV MASTODON_MIN_DIST=0
ENV PATH="$PATH:/usr/share/vesselalert:/tools"
LABEL org.opencontainers.image.source = "https://github.com/sdr-enthusiasts/docker-vesselalert"
SHELL ["/bin/bash", "-x", "-o", "pipefail", "-c"]
# hadolint ignore=DL3008,SC2086,SC2039,SC2068
RUN \
--mount=type=bind,from=build,source=/,target=/build \
# define required packages
TEMP_PACKAGES=() && \
KEPT_PACKAGES=() && \
KEPT_PACKAGES+=(bc) && \
KEPT_PACKAGES+=(jq) && \
KEPT_PACKAGES+=(nano) && \
KEPT_PACKAGES+=(curl) && \
#
# 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[@]}" \
&& \
# add files from the build container:
mkdir -p /usr/share/vesselalert && \
cp -f /build/src/distance /usr/share/vesselalert/distance && \
cp -f /build/.CONTAINER_VERSION /.CONTAINER_VERSION && \
# 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 -q -o APT::Autoremove::RecommendsImportant=0 -o APT::Autoremove::SuggestsImportant=0 -y && \
apt-get clean -q -y && \
#
# set CONTAINER_VERSION:
rm -rf /src/* /tmp/* /var/lib/apt/lists/*
COPY rootfs/ /
# Add healthcheck
# HEALTHCHECK --start-period=60s --interval=600s --timeout=60s CMD /healthcheck/healthcheck.sh