From 575c1dc352d5e30cdb07af25f52291e2c162d394 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marcin=20Szyma=C5=84ski?= Date: Thu, 2 Jul 2020 09:21:06 +0100 Subject: [PATCH] feat: add support for rpi4 and other architechtures (#24) * add support for rpi4 (arm32v7) and other architectures --- Dockerfile | 38 ++++++++++++++++++++++++-------- README.md | 2 +- build/fr24feed.sh | 20 +++++++++++++++++ build/s6-overlay.sh | 15 +++++++++++++ root/etc/services.d/fr24feed/run | 4 ++-- 5 files changed, 67 insertions(+), 12 deletions(-) create mode 100755 build/fr24feed.sh create mode 100755 build/s6-overlay.sh diff --git a/Dockerfile b/Dockerfile index 6b594da..ad19430 100644 --- a/Dockerfile +++ b/Dockerfile @@ -61,6 +61,29 @@ RUN ./sensible-build.sh ${DEBIAN_VERSION} && \ cd package-${DEBIAN_VERSION} && \ dpkg-buildpackage -b +# CONF +FROM debian:buster as confd + +ENV CONFD_VERSION v0.16.0 + +WORKDIR /tmp +RUN apt-get update -y && \ + apt-get install -y \ + sudo \ + git-core \ + build-essential \ + golang && \ + rm -rf /var/lib/apt/lists/* + +RUN git clone -b ${CONFD_VERSION} --depth 1 https://github.com/kelseyhightower/confd.git && \ + cd confd && \ + export GOPATH=/tmp/go && \ + go get github.com/BurntSushi/toml && \ + go get github.com/kelseyhightower/confd/backends && \ + go get github.com/kelseyhightower/confd/log && \ + go get github.com/kelseyhightower/confd/resource/template && \ + make + FROM debian:buster-slim as serve ENV DEBIAN_VERSION buster @@ -142,20 +165,17 @@ RUN rm /usr/lib/fr24/public_html/config.js COPY --from=piaware /tmp/piaware_builder /tmp/piaware_builder RUN cd /tmp/piaware_builder && dpkg -i piaware_*_*.deb && rm -rf /tmp/piaware && rm /etc/piaware.conf +ADD build /build + # FR24FEED -WORKDIR /fr24feed -ADD https://repo-feed.flightradar24.com/linux_x86_64_binaries/fr24feed_${FR24FEED_VERSION}_amd64.tgz /fr24feed -RUN tar -xzf *amd64.tgz && rm *amd64.tgz +RUN /build/fr24feed.sh # CONFD -ADD https://github.com/kelseyhightower/confd/releases/download/v0.16.0/confd-0.16.0-linux-amd64 /tmp/ -RUN mkdir -p /opt/confd/bin && \ - mv /tmp/confd-0.16.0-linux-amd64 /opt/confd/bin/confd && \ - chmod +x /opt/confd/bin/confd +COPY --from=confd /tmp/confd/bin/confd /opt/confd/bin/confd # S6 OVERLAY -ADD https://github.com/just-containers/s6-overlay/releases/download/v1.21.8.0/s6-overlay-amd64.tar.gz /tmp/ -RUN tar xzf /tmp/s6-overlay-amd64.tar.gz -C / && rm /tmp/s6-overlay-amd64.tar.gz +RUN /build/s6-overlay.sh + COPY /root / EXPOSE 8754 8080 30001 30002 30003 30004 30005 30104 diff --git a/README.md b/README.md index 598f41e..8a42f0e 100644 --- a/README.md +++ b/README.md @@ -94,7 +94,7 @@ docker run -it --rm \ thomx/fr24feed-piaware /bin/bash ``` -Then : `/fr24feed/fr24feed_amd64/fr24feed --signup` and follow the instructions, for technical steps, your answer doesn't matter we just need the sharing key at the end. +Then : `/fr24feed/fr24feed/fr24feed --signup` and follow the instructions, for technical steps, your answer doesn't matter we just need the sharing key at the end. Finally to see the sharing key run `cat /etc/fr24feed.ini`, you can now exit the container. diff --git a/build/fr24feed.sh b/build/fr24feed.sh new file mode 100755 index 0000000..fcbfcb5 --- /dev/null +++ b/build/fr24feed.sh @@ -0,0 +1,20 @@ +#!/bin/sh +arch=$(uname -m) + +case $arch in + armv7l) + url=https://repo-feed.flightradar24.com/rpi_binaries/fr24feed_${FR24FEED_VERSION}_armhf.tgz + dirname=fr24feed_armhf + ;; + *) + url=https://repo-feed.flightradar24.com/linux_x86_64_binaries/fr24feed_${FR24FEED_VERSION}_amd64.tgz + dirname=fr24feed_amd64 + ;; +esac + +mkdir /fr24feed && \ +wget -O /fr24feed/fr24feed.tgz $url && \ +cd /fr24feed && \ +tar -xzf fr24feed.tgz && \ +mv $dirname fr24feed && \ +rm /fr24feed/fr24feed.tgz diff --git a/build/s6-overlay.sh b/build/s6-overlay.sh new file mode 100755 index 0000000..514d215 --- /dev/null +++ b/build/s6-overlay.sh @@ -0,0 +1,15 @@ +#!/bin/sh +arch=$(uname -m) + +case $arch in + armv7l) + url=https://github.com/just-containers/s6-overlay/releases/download/v1.21.8.0/s6-overlay-armhf.tar.gz + ;; + *) + url=https://github.com/just-containers/s6-overlay/releases/download/v1.21.8.0/s6-overlay-amd64.tar.gz + ;; +esac + +wget -O /tmp/s6-overlay.tar.gz $url && \ +tar xzf /tmp/s6-overlay.tar.gz -C / && rm /tmp/s6-overlay.tar.gz + diff --git a/root/etc/services.d/fr24feed/run b/root/etc/services.d/fr24feed/run index 6c79e38..9fd2f4e 100644 --- a/root/etc/services.d/fr24feed/run +++ b/root/etc/services.d/fr24feed/run @@ -1,7 +1,7 @@ #!/usr/bin/with-contenv bash if [ "$SERVICE_ENABLE_FR24FEED" != "false" ] then - /fr24feed/fr24feed_amd64/fr24feed + /fr24feed/fr24feed/fr24feed else tail -f /dev/null -fi \ No newline at end of file +fi