Skip to content

Commit

Permalink
reduce image sizes by using common wreadsb base image for images that…
Browse files Browse the repository at this point in the history
… use mlat-client (#352)

* base wreadsb on soapyrtlsdr

* include mlat-client in wreadsb

mlat-client is used by a couple of images, to remove redundand download
size and disk space usage, include it in this baseimage and use it when
mlat-client is needed

* dump978-full: use wreadsb as base

* remove python3-minimal from baseimage

main motivation was commonality for ADS-B images using mlat-client, this
is now achieved by other means

* dumphfdl trigger: fix dependency
  • Loading branch information
wiedehopf authored Jan 12, 2025
1 parent 43d0cf6 commit 286de5d
Show file tree
Hide file tree
Showing 6 changed files with 23 additions and 11 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/deploy_ghcr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -551,7 +551,7 @@ jobs:

deploy_dump978-full:
name: Deploy dump978-full to ghcr.io
needs: [deploy_soapyrtlsdr]
needs: [deploy_wreadsb]
runs-on: ubuntu-latest
permissions:
contents: read
Expand Down Expand Up @@ -602,7 +602,7 @@ jobs:

deploy_wreadsb:
name: Deploy wreadsb to ghcr.io
needs: [deploy_ghcr_rtlsdr]
needs: [deploy_ghcr_soapyrtlsdr, deploy_ghcr_mlat_client]
runs-on: ubuntu-latest
permissions:
contents: read
Expand Down Expand Up @@ -768,7 +768,7 @@ jobs:
trigger_build_sdr-enthusiasts_docker-dumphfdl:
name: Trigger deploy of sdr-enthusiasts/docker-dumphfdl
needs: [deploy_ghcr_acars-decoder]
needs: [deploy_ghcr_acars-decoder-soapy]
runs-on: ubuntu-latest
env:
WORKFLOW_AUTH_TOKEN: ${{ secrets.GH_PAT_MIKENYE }}
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/deploy_wreadsb.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ jobs:

deploy_wreadsb:
name: Deploy wreadsb to ghcr.io
needs: [deploy_ghcr_mlat_client]
runs-on: ubuntu-latest
permissions:
contents: read
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/on_pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -918,7 +918,7 @@ jobs:
deploy_dump978-full:
name: Test deploy dump978-full to ghcr.io
# Define any dependent steps
needs: [deploy_soapyrtlsdr]
needs: [deploy_wreadsb]
# Define dockerfile and image tag
env:
DOCKERFILE: Dockerfile.dump978-full
Expand Down Expand Up @@ -1012,7 +1012,7 @@ jobs:
deploy_wreadsb:
name: Test deploy wreadsb to ghcr.io
# Define any dependent steps
needs: [deploy_ghcr_rtlsdr]
needs: [deploy_ghcr_soapyrtlsdr, deploy_ghcr_mlat_client]
# Define dockerfile and image tag
env:
DOCKERFILE: Dockerfile.wreadsb
Expand Down
2 changes: 0 additions & 2 deletions Dockerfile.base
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,6 @@ RUN \
KEPT_PACKAGES+=(nano) && \
KEPT_PACKAGES+=(iputils-ping) && \
KEPT_PACKAGES+=(dnsutils) && \
# used by enough images to warrant installing it in common (adds 17 MB to image size)
KEPT_PACKAGES+=(python3-minimal) && \
# install packages
## Builder fixes...
mkdir -p /usr/sbin/ && \
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile.dump978-full
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM ghcr.io/sdr-enthusiasts/docker-baseimage:soapyrtlsdr
FROM ghcr.io/sdr-enthusiasts/docker-baseimage:wreadsb

SHELL ["/bin/bash", "-o", "pipefail", "-c"]

Expand Down
19 changes: 16 additions & 3 deletions Dockerfile.wreadsb
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
FROM ghcr.io/sdr-enthusiasts/docker-baseimage:rtlsdr
FROM ghcr.io/sdr-enthusiasts/docker-baseimage:mlatclient AS buildimage

SHELL ["/bin/bash", "-o", "pipefail", "-c"]
FROM ghcr.io/sdr-enthusiasts/docker-baseimage:soapyrtlsdr

SHELL ["/bin/bash", "-x", "-o", "pipefail", "-c"]

# hadolint ignore=DL3008,SC2086,DL4006,SC2039
RUN set -x && \
RUN \
--mount=type=bind,from=buildimage,source=/,target=/buildimage/ \
TEMP_PACKAGES=() && \
KEPT_PACKAGES=() && \
# packages needed to install
Expand All @@ -19,6 +22,9 @@ RUN set -x && \
TEMP_PACKAGES+=(libusb-1.0-0-dev) && \
TEMP_PACKAGES+=(libzstd-dev) && \
KEPT_PACKAGES+=(libzstd1) && \
# Needed to run the mlat_client:
KEPT_PACKAGES+=(python3-minimal) && \
KEPT_PACKAGES+=(python3-pkg-resources) && \
# install packages
apt-get update && \
apt-get install -y --no-install-recommends \
Expand Down Expand Up @@ -50,8 +56,15 @@ RUN set -x && \
# readsb: simple tests
readsb --version && \
viewadsb --version && \
# Get mlat-client
tar zxf /buildimage/mlatclient.tgz -C / && \
ln -s /usr/local/bin/mlat-client /usr/bin/mlat-client && \
# Clean up
apt-get remove -y "${TEMP_PACKAGES[@]}" && \
apt-get autoremove -q -o APT::Autoremove::RecommendsImportant=0 -o APT::Autoremove::SuggestsImportant=0 -y && \
# test mlat-client
/usr/bin/mlat-client --help > /dev/null && \
# remove pycache introduced by testing mlat-client
{ find /usr | grep -E "/__pycache__$" | xargs rm -rf || true; } && \
rm -rf /src/* && \
bash /scripts/clean-build.sh

0 comments on commit 286de5d

Please sign in to comment.