forked from wiedehopf/readsb
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
docker: use separate repo for builder
this avoids unnecessary caching / rebuilds
- Loading branch information
Showing
2 changed files
with
12 additions
and
58 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,65 +1,21 @@ | ||
FROM debian:bookworm-slim AS builder | ||
RUN apt-get update && \ | ||
apt-get install --no-install-recommends -y \ | ||
git \ | ||
wget \ | ||
pkg-config \ | ||
autoconf \ | ||
gcc \ | ||
make \ | ||
libusb-1.0-0-dev \ | ||
librtlsdr-dev \ | ||
libncurses-dev \ | ||
zlib1g-dev \ | ||
libzstd-dev \ | ||
ca-certificates | ||
|
||
# install jemalloc | ||
RUN JEMALLOC_BDIR=$(mktemp -d) && \ | ||
git clone --depth 1 https://github.com/jemalloc/jemalloc $JEMALLOC_BDIR && \ | ||
cd $JEMALLOC_BDIR && \ | ||
./autogen.sh && \ | ||
./configure --with-lg-page=14 && \ | ||
make -j$(nproc) && \ | ||
make install && \ | ||
rm -rf $JEMALLOC_BDIR | ||
|
||
# install readsb | ||
SHELL ["/bin/bash", "-x", "-o", "pipefail", "-c"] | ||
RUN --mount=type=bind,source=.,target=/app/git \ | ||
cd /app/git && \ | ||
READSB_BUILD_DIR=$(mktemp -d) && \ | ||
cp -r /app/git/* $READSB_BUILD_DIR && \ | ||
cd $READSB_BUILD_DIR && \ | ||
[[ $(uname -m) == x86_64 ]] && MARCH=" -march=nehalem" || MARCH="" && \ | ||
make -j$(nproc) RTLSDR=yes OPTIMIZE="-O2 $MARCH" && \ | ||
mv readsb /usr/local/bin && \ | ||
mv viewadsb /usr/local/bin && \ | ||
chmod +x /usr/local/bin/viewadsb /usr/local/bin/readsb && \ | ||
make clean && \ | ||
make -j$(nproc) PRINT_UUIDS=yes TRACKS_UUID=yes OPTIMIZE="-O2 $MARCH" && \ | ||
mv readsb /usr/local/bin/readsb-uuid && \ | ||
mv viewadsb /usr/local/bin/viewadsb-uuid && \ | ||
chmod +x /usr/local/bin/viewadsb-uuid && \ | ||
chmod +x /usr/local/bin/readsb-uuid && \ | ||
rm -rf $READSB_BUILD_DIR && \ | ||
mkdir -p /usr/local/share/tar1090 && \ | ||
wget -O /usr/local/share/tar1090/aircraft.csv.gz https://github.com/wiedehopf/tar1090-db/raw/csv/aircraft.csv.gz && \ | ||
true | ||
FROM ghcr.io/wiedehopf/readsb-builder:latest AS builder | ||
|
||
FROM debian:bookworm-slim | ||
RUN apt-get update && \ | ||
RUN \ | ||
--mount=type=bind,from=builder,source=/,target=/builder/ \ | ||
apt-get update && \ | ||
apt-get -y install --no-install-recommends \ | ||
wget \ | ||
librtlsdr0 libncurses6 zlib1g libzstd1 && \ | ||
apt-get clean && \ | ||
wget -O /usr/local/share/tar1090/aircraft.csv.gz https://github.com/wiedehopf/tar1090-db/raw/csv/aircraft.csv.gz && \ | ||
rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* && \ | ||
mkdir -p /run/readsb | ||
mkdir -p /run/readsb && \ | ||
cp /builder/usr/local/bin/readsb* /usr/local/bin/ && \ | ||
cp /builder/usr/local/bin/viewadsb* /usr/local/bin/ && \ | ||
cp /builder/usr/local/lib/libjemalloc.so.2 /usr/local/lib/libjemalloc.so.2 && \ | ||
true | ||
|
||
ENV LD_PRELOAD=/usr/local/lib/libjemalloc.so.2 | ||
COPY --from=builder /usr/local/bin/readsb* /usr/local/bin/ | ||
COPY --from=builder /usr/local/bin/viewadsb* /usr/local/bin/ | ||
COPY --from=builder /usr/local/share/tar1090/aircraft.csv.gz /usr/local/share/tar1090/aircraft.csv.gz | ||
COPY --from=builder /usr/local/lib/libjemalloc.so.2 /usr/local/lib/libjemalloc.so.2 | ||
|
||
ENTRYPOINT ["/usr/local/bin/readsb"] |