docker optimization

* move openwebrx project tools to a separate layer for lower download
  volume and faster builds
* use COPY instead of ADD
* COPY multiple files at once to reduce number of layers
This commit is contained in:
Jakob Ketterl 2020-09-01 23:30:48 +02:00
parent f90670f477
commit f47ebb2adb
16 changed files with 88 additions and 58 deletions

View File

@ -1,7 +1,7 @@
ARG ARCHTAG ARG ARCHTAG
FROM openwebrx-soapysdr-base:$ARCHTAG FROM openwebrx-soapysdr-base:$ARCHTAG
ADD docker/scripts/install-dependencies-airspy.sh / COPY docker/scripts/install-dependencies-airspy.sh /
RUN /install-dependencies-airspy.sh &&\ RUN /install-dependencies-airspy.sh &&\
rm /install-dependencies-airspy.sh rm /install-dependencies-airspy.sh

View File

@ -1,11 +1,14 @@
FROM debian:buster-slim FROM debian:buster-slim
ADD docker/files/js8call/js8call-hamlib.patch / COPY docker/files/js8call/js8call-hamlib.patch \
ADD docker/files/wsjtx/*.patch / docker/files/wsjtx/*.patch \
ADD docker/scripts/install-dependencies.sh / docker/scripts/install-dependencies.sh \
docker/scripts/install-owrx-tools.sh /
RUN /install-dependencies.sh && \ RUN /install-dependencies.sh && \
rm /install-dependencies.sh && \ rm /install-dependencies.sh && \
rm /*.patch rm /*.patch
RUN /install-owrx-tools.sh && \
rm /install-owrx-tools.sh
ENTRYPOINT ["/init"] ENTRYPOINT ["/init"]

View File

@ -1,8 +1,8 @@
ARG ARCHTAG ARG ARCHTAG
FROM openwebrx-soapysdr-base:$ARCHTAG FROM openwebrx-soapysdr-base:$ARCHTAG
ADD docker/scripts/install-dependencies-fcdpp.sh / COPY docker/scripts/install-dependencies-fcdpp.sh /
RUN /install-dependencies-fcdpp.sh &&\ RUN /install-dependencies-fcdpp.sh &&\
rm /install-dependencies-fcdpp.sh rm /install-dependencies-fcdpp.sh
ADD . /opt/openwebrx COPY . /opt/openwebrx

View File

@ -1,8 +1,9 @@
ARG ARCHTAG ARG ARCHTAG
FROM openwebrx-base:$ARCHTAG FROM openwebrx-base:$ARCHTAG
ADD docker/scripts/install-dependencies-*.sh / COPY docker/scripts/install-dependencies-*.sh \
ADD docker/files/sdrplay/install-lib.*.patch / docker/files/sdrplay/install-lib.*.patch \
docker/scripts/install-connectors.sh /
RUN /install-dependencies-rtlsdr.sh &&\ RUN /install-dependencies-rtlsdr.sh &&\
/install-dependencies-soapysdr.sh &&\ /install-dependencies-soapysdr.sh &&\
@ -16,13 +17,11 @@ RUN /install-dependencies-rtlsdr.sh &&\
/install-dependencies-perseus.sh &&\ /install-dependencies-perseus.sh &&\
/install-dependencies-fcdpp.sh &&\ /install-dependencies-fcdpp.sh &&\
/install-dependencies-radioberry.sh &&\ /install-dependencies-radioberry.sh &&\
/install-connectors.sh &&\
rm /install-dependencies-*.sh &&\ rm /install-dependencies-*.sh &&\
rm /install-lib.*.patch rm /install-lib.*.patch && \
ADD docker/scripts/install-connectors.sh /
RUN /install-connectors.sh &&\
rm /install-connectors.sh rm /install-connectors.sh
ADD docker/files/services/sdrplay /etc/services.d/sdrplay COPY docker/files/services/sdrplay /etc/services.d/sdrplay
ADD . /opt/openwebrx ADD . /opt/openwebrx

View File

@ -1,8 +1,8 @@
ARG ARCHTAG ARG ARCHTAG
FROM openwebrx-soapysdr-base:$ARCHTAG FROM openwebrx-soapysdr-base:$ARCHTAG
ADD docker/scripts/install-dependencies-hackrf.sh / COPY docker/scripts/install-dependencies-hackrf.sh /
RUN /install-dependencies-hackrf.sh &&\ RUN /install-dependencies-hackrf.sh &&\
rm /install-dependencies-hackrf.sh rm /install-dependencies-hackrf.sh
ADD . /opt/openwebrx COPY . /opt/openwebrx

View File

@ -1,8 +1,8 @@
ARG ARCHTAG ARG ARCHTAG
FROM openwebrx-soapysdr-base:$ARCHTAG FROM openwebrx-soapysdr-base:$ARCHTAG
ADD docker/scripts/install-dependencies-limesdr.sh / COPY docker/scripts/install-dependencies-limesdr.sh /
RUN /install-dependencies-limesdr.sh &&\ RUN /install-dependencies-limesdr.sh &&\
rm /install-dependencies-limesdr.sh rm /install-dependencies-limesdr.sh
ADD . /opt/openwebrx COPY . /opt/openwebrx

View File

@ -1,8 +1,8 @@
ARG ARCHTAG ARG ARCHTAG
FROM openwebrx-base:$ARCHTAG FROM openwebrx-base:$ARCHTAG
ADD docker/scripts/install-dependencies-perseus.sh / COPY docker/scripts/install-dependencies-perseus.sh /
RUN /install-dependencies-perseus.sh &&\ RUN /install-dependencies-perseus.sh &&\
rm /install-dependencies-perseus.sh rm /install-dependencies-perseus.sh
ADD . /opt/openwebrx COPY . /opt/openwebrx

View File

@ -1,8 +1,8 @@
ARG ARCHTAG ARG ARCHTAG
FROM openwebrx-soapysdr-base:$ARCHTAG FROM openwebrx-soapysdr-base:$ARCHTAG
ADD docker/scripts/install-dependencies-plutosdr.sh / COPY docker/scripts/install-dependencies-plutosdr.sh /
RUN /install-dependencies-plutosdr.sh &&\ RUN /install-dependencies-plutosdr.sh &&\
rm /install-dependencies-plutosdr.sh rm /install-dependencies-plutosdr.sh
ADD . /opt/openwebrx COPY . /opt/openwebrx

View File

@ -1,8 +1,8 @@
ARG ARCHTAG ARG ARCHTAG
FROM openwebrx-soapysdr-base:$ARCHTAG FROM openwebrx-soapysdr-base:$ARCHTAG
ADD docker/scripts/install-dependencies-radioberry.sh / COPY docker/scripts/install-dependencies-radioberry.sh /
RUN /install-dependencies-radioberry.sh &&\ RUN /install-dependencies-radioberry.sh &&\
rm /install-dependencies-radioberry.sh rm /install-dependencies-radioberry.sh
ADD . /opt/openwebrx COPY . /opt/openwebrx

View File

@ -1,12 +1,12 @@
ARG ARCHTAG ARG ARCHTAG
FROM openwebrx-base:$ARCHTAG FROM openwebrx-base:$ARCHTAG
ADD docker/scripts/install-dependencies-rtlsdr.sh / COPY docker/scripts/install-dependencies-rtlsdr.sh \
ADD docker/scripts/install-connectors.sh / docker/scripts/install-connectors.sh /
RUN /install-dependencies-rtlsdr.sh &&\ RUN /install-dependencies-rtlsdr.sh &&\
rm /install-dependencies-rtlsdr.sh &&\ rm /install-dependencies-rtlsdr.sh &&\
/install-connectors.sh &&\ /install-connectors.sh &&\
rm /install-connectors.sh rm /install-connectors.sh
ADD . /opt/openwebrx COPY . /opt/openwebrx

View File

@ -1,8 +1,8 @@
ARG ARCHTAG ARG ARCHTAG
FROM openwebrx-soapysdr-base:$ARCHTAG FROM openwebrx-soapysdr-base:$ARCHTAG
ADD docker/scripts/install-dependencies-rtlsdr-soapy.sh / COPY docker/scripts/install-dependencies-rtlsdr-soapy.sh /
RUN /install-dependencies-rtlsdr-soapy.sh &&\ RUN /install-dependencies-rtlsdr-soapy.sh &&\
rm /install-dependencies-rtlsdr-soapy.sh rm /install-dependencies-rtlsdr-soapy.sh
ADD . /opt/openwebrx COPY . /opt/openwebrx

View File

@ -1,12 +1,12 @@
ARG ARCHTAG ARG ARCHTAG
FROM openwebrx-soapysdr-base:$ARCHTAG FROM openwebrx-soapysdr-base:$ARCHTAG
ADD docker/scripts/install-dependencies-sdrplay.sh / COPY docker/scripts/install-dependencies-sdrplay.sh \
ADD docker/files/sdrplay/install-lib.*.patch / docker/files/sdrplay/install-lib.*.patch /
RUN /install-dependencies-sdrplay.sh &&\ RUN /install-dependencies-sdrplay.sh &&\
rm /install-dependencies-sdrplay.sh &&\ rm /install-dependencies-sdrplay.sh &&\
rm /install-lib.*.patch rm /install-lib.*.patch
ADD docker/files/services/sdrplay /etc/services.d/sdrplay COPY docker/files/services/sdrplay /etc/services.d/sdrplay
ADD . /opt/openwebrx COPY . /opt/openwebrx

View File

@ -1,8 +1,8 @@
ARG ARCHTAG ARG ARCHTAG
FROM openwebrx-soapysdr-base:$ARCHTAG FROM openwebrx-soapysdr-base:$ARCHTAG
ADD docker/scripts/install-dependencies-soapyremote.sh / COPY docker/scripts/install-dependencies-soapyremote.sh /
RUN /install-dependencies-soapyremote.sh &&\ RUN /install-dependencies-soapyremote.sh &&\
rm /install-dependencies-soapyremote.sh rm /install-dependencies-soapyremote.sh
ADD . /opt/openwebrx COPY . /opt/openwebrx

View File

@ -1,8 +1,8 @@
ARG ARCHTAG ARG ARCHTAG
FROM openwebrx-base:$ARCHTAG FROM openwebrx-base:$ARCHTAG
ADD docker/scripts/install-dependencies-soapysdr.sh / COPY docker/scripts/install-dependencies-soapysdr.sh \
ADD docker/scripts/install-connectors.sh / docker/scripts/install-connectors.sh /
RUN /install-dependencies-soapysdr.sh &&\ RUN /install-dependencies-soapysdr.sh &&\
rm /install-dependencies-soapysdr.sh &&\ rm /install-dependencies-soapysdr.sh &&\
/install-connectors.sh &&\ /install-connectors.sh &&\

View File

@ -19,7 +19,7 @@ function cmakebuild() {
cd /tmp cd /tmp
STATIC_PACKAGES="sox libfftw3-bin python3 python3-setuptools netcat-openbsd libsndfile1 liblapack3 libusb-1.0-0 libqt5core5a libreadline7 libgfortran4 libgomp1 libasound2 libudev1 ca-certificates libqt5gui5 libqt5sql5 libqt5printsupport5" STATIC_PACKAGES="sox libfftw3-bin python3 python3-setuptools netcat-openbsd libsndfile1 liblapack3 libusb-1.0-0 libqt5core5a libreadline7 libgfortran4 libgomp1 libasound2 libudev1 ca-certificates libqt5gui5 libqt5sql5 libqt5printsupport5"
BUILD_PACKAGES="wget git libsndfile1-dev libfftw3-dev cmake make gcc g++ liblapack-dev autoconf automake libtool texinfo gfortran libusb-1.0-0-dev qtbase5-dev qtmultimedia5-dev qttools5-dev libqt5serialport5-dev qttools5-dev-tools asciidoctor asciidoc libasound2-dev pkg-config libudev-dev libhamlib-dev patch xsltproc" BUILD_PACKAGES="wget git libsndfile1-dev libfftw3-dev cmake make gcc g++ liblapack-dev texinfo gfortran libusb-1.0-0-dev qtbase5-dev qtmultimedia5-dev qttools5-dev libqt5serialport5-dev qttools5-dev-tools asciidoctor asciidoc libasound2-dev libudev-dev libhamlib-dev patch xsltproc"
apt-get update apt-get update
apt-get -y install auto-apt-proxy apt-get -y install auto-apt-proxy
apt-get -y install --no-install-recommends $STATIC_PACKAGES $BUILD_PACKAGES apt-get -y install --no-install-recommends $STATIC_PACKAGES $BUILD_PACKAGES
@ -42,33 +42,12 @@ tar xzf s6-overlay-${PLATFORM}.tar.gz -C /
rm s6-overlay-${PLATFORM}.tar.gz rm s6-overlay-${PLATFORM}.tar.gz
popd popd
git clone https://github.com/jketterl/js8py.git
pushd js8py
git checkout 888e62be375316882ad2b2ac8e396c3bf857b6fc
python3 setup.py install
popd
rm -rf js8py
git clone https://git.code.sf.net/p/itpp/git itpp git clone https://git.code.sf.net/p/itpp/git itpp
cmakebuild itpp bb5c7e95f40e8fdb5c3f3d01a84bcbaf76f3676d cmakebuild itpp bb5c7e95f40e8fdb5c3f3d01a84bcbaf76f3676d
git clone https://github.com/jketterl/csdr.git
cd csdr
# develop as of 2020-08-28
git checkout 6d60d8c71f3484fd502174a2af27ceaaec6e60f8
autoreconf -i
./configure
make
make install
cd ..
rm -rf csdr
git clone https://github.com/szechyjs/mbelib.git git clone https://github.com/szechyjs/mbelib.git
cmakebuild mbelib 9a04ed5c78176a9965f3d43f7aa1b1f5330e771f cmakebuild mbelib 9a04ed5c78176a9965f3d43f7aa1b1f5330e771f
git clone https://github.com/jketterl/digiham.git
cmakebuild digiham 95206501be89b38d0267bf6c29a6898e7c65656f
git clone https://github.com/f4exb/dsd.git git clone https://github.com/f4exb/dsd.git
cmakebuild dsd f6939f9edbbc6f66261833616391a4e59cb2b3d7 cmakebuild dsd f6939f9edbbc6f66261833616391a4e59cb2b3d7

View File

@ -0,0 +1,49 @@
#!/bin/bash
set -euxo pipefail
export MAKEFLAGS="-j4"
function cmakebuild() {
cd $1
if [[ ! -z "${2:-}" ]]; then
git checkout $2
fi
mkdir build
cd build
cmake ${CMAKE_ARGS:-} ..
make
make install
cd ../..
rm -rf $1
}
cd /tmp
STATIC_PACKAGES="libfftw3-bin"
BUILD_PACKAGES="git autoconf automake libtool libfftw3-dev pkg-config cmake make gcc g++"
apt-get update
apt-get -y install --no-install-recommends $STATIC_PACKAGES $BUILD_PACKAGES
git clone https://github.com/jketterl/js8py.git
pushd js8py
git checkout 888e62be375316882ad2b2ac8e396c3bf857b6fc
python3 setup.py install
popd
rm -rf js8py
git clone https://github.com/jketterl/csdr.git
cd csdr
# develop as of 2020-08-28
git checkout 6d60d8c71f3484fd502174a2af27ceaaec6e60f8
autoreconf -i
./configure
make
make install
cd ..
rm -rf csdr
git clone https://github.com/jketterl/digiham.git
cmakebuild digiham 95206501be89b38d0267bf6c29a6898e7c65656f
apt-get -y purge --autoremove $BUILD_PACKAGES
apt-get clean
rm -rf /var/lib/apt/lists/*