From 28d3239eb21eb93ead9223fa2e446b2f1ab86f45 Mon Sep 17 00:00:00 2001 From: Matthias Wirth Date: Fri, 31 May 2024 22:33:17 +0200 Subject: [PATCH] make timelapse1090 load on demand instead of timelapse1090 being part of the image, just install it on image startup if the option is enabled this saves 12 MB image size --- Dockerfile | 8 ------- .../etc/s6-overlay/startup.d/11-timelapse1090 | 21 +++++++++++++++++++ 2 files changed, 21 insertions(+), 8 deletions(-) create mode 100755 rootfs/etc/s6-overlay/startup.d/11-timelapse1090 diff --git a/Dockerfile b/Dockerfile index 6118f7a..c48ca53 100644 --- a/Dockerfile +++ b/Dockerfile @@ -84,14 +84,6 @@ RUN set -x && \ rm -rf "${TAR1090_UPDATE_DIR}" && \ # tar1090: add nginx config cp -Rv /etc/nginx.tar1090/* /etc/nginx/ && \ - # timelapse1090 - git clone --single-branch --depth 1 "https://github.com/wiedehopf/timelapse1090.git" "${GITPATH_TIMELAPSE1090}" && \ - pushd "${GITPATH_TIMELAPSE1090}" && \ - bash -ec 'echo "timelapse1090 $(git log | head -1 | tr -s " " "_")" >> /VERSIONS' && \ - # remove unused .git dir to slightly reduce image size - rm -rf "${GITPATH_TIMELAPSE1090}/.git" && \ - popd && \ - mkdir -p /var/timelapse1090 && \ # aircraft-db, file in TAR1090_UPDATE_DIR will be preferred when starting readsb if tar1090-update enabled curl -o "${TAR1090_INSTALL_DIR}/aircraft.csv.gz" "https://raw.githubusercontent.com/wiedehopf/tar1090-db/csv/aircraft.csv.gz" && \ # clone graphs1090 repo diff --git a/rootfs/etc/s6-overlay/startup.d/11-timelapse1090 b/rootfs/etc/s6-overlay/startup.d/11-timelapse1090 new file mode 100755 index 0000000..9b60ab0 --- /dev/null +++ b/rootfs/etc/s6-overlay/startup.d/11-timelapse1090 @@ -0,0 +1,21 @@ +#!/command/with-contenv bash +# shellcheck shell=bash disable=SC1091,SC2015,SC2153 + +source /scripts/common + +if ! chk_enabled "${ENABLE_TIMELAPSE1090}" || chk_enabled "${TAR1090_DISABLE}"; then + exit 0 +fi + +if [[ -d "${GITPATH_TIMELAPSE1090}" ]]; then + exit 0 +fi + +# timelapse1090 +git clone --single-branch --depth 1 "https://github.com/wiedehopf/timelapse1090.git" "${GITPATH_TIMELAPSE1090}" +pushd "${GITPATH_TIMELAPSE1090}" +bash -ec 'echo "timelapse1090 $(git log | head -1 | tr -s " " "_")" >> /VERSIONS' +# remove unused .git dir to slightly reduce image size +rm -rf "${GITPATH_TIMELAPSE1090}/.git" +popd +mkdir -p /var/timelapse1090