From 110f6adf093e8b37d1ce0bf756929a64a4e4b7b9 Mon Sep 17 00:00:00 2001 From: Christoph Honal Date: Wed, 12 Feb 2020 17:57:13 +0100 Subject: [PATCH] scripts and fixes --- Dockerfile | 18 ++++++++++-------- scripts/build.sh | 4 ++-- scripts/buildx.sh | 10 ++++++++++ scripts/push.sh | 11 ++--------- scripts/run.sh | 6 +++++- 5 files changed, 29 insertions(+), 20 deletions(-) create mode 100644 scripts/buildx.sh diff --git a/Dockerfile b/Dockerfile index cf6756f..8503d3d 100644 --- a/Dockerfile +++ b/Dockerfile @@ -39,7 +39,7 @@ ENV DEBIAN_FRONTEND=noninteractive TZ=Europe/Berlin # Setup build deps RUN apt-get update && \ apt-get -y install --no-install-recommends build-essential git cmake autoconf automake unzip libtool-bin pkgconf libssl-dev \ - python2.7 python-pip libcppunit-dev swig uuid-dev libusb-1.0-0-dev \ + python2.7 python-pip python3 python3-pip python-cheetah libcppunit-dev swig uuid-dev libusb-1.0-0-dev \ python-mako libzmq3-dev libcomedi-dev python-sip-dev python-six socat && \ rm -rf /var/lib/apt/lists/* @@ -49,7 +49,7 @@ FROM base-cli as base-gui # Setup grc and gui deps RUN apt-get update && \ - apt-get -y install --no-install-recommends python-numpy python-wxgtk3.0 python-cheetah libzmq3-dev \ + apt-get -y install --no-install-recommends python-numpy python-wxgtk3.0 libzmq3-dev \ libqt4-opengl-dev python-qt4 libqwt-dev python-gtk2 python-lxml && \ rm -rf /var/lib/apt/lists/* @@ -73,15 +73,17 @@ RUN mkdir build && cd build && \ FROM base-${UI_MODE} AS run # Copy sources from build stage -COPY --from=build /app/move2radio/build/prefix/usr /usr +COPY --from=build /app/move2radio/build/prefix/usr /app/move2radio/build/prefix/usr +COPY --from=build /app/move2radio/AppDir/move-ii-gr /app/move2radio/AppDir/move-ii-gr +ENV PATH="/app/move2radio/build/prefix/usr/bin:${PATH}" \ + PYTHONPATH="/app/move2radio/build/prefix/usr/lib/python2.7/dist-packages:${PYTHONPATH}" \ + LD_LIBRARY_PATH="/app/move2radio/build/prefix/usr/lib:${LD_LIBRARY_PATH}" # Install binaries -COPY build/blocks/* /usr/share/gnuradio/grc/blocks/ -RUN chmod 644 /usr/share/gnuradio/grc/blocks/*.xml && \ - ldconfig +COPY build/blocks/* app/move2radio/build/prefix/usr/share/gnuradio/grc/blocks/ COPY build/fakeserver/* /app/fakeserver/ COPY build/run.sh /app/run.sh +RUN chmod 644 app/move2radio/build/prefix/usr/share/gnuradio/grc/blocks/*.xml && \ + chmod +x /app/run.sh && ldconfig -# Entrypoint -RUN chmod +x /app/run.sh ENTRYPOINT ["/app/run.sh"] \ No newline at end of file diff --git a/scripts/build.sh b/scripts/build.sh index 87135b2..db164b4 100644 --- a/scripts/build.sh +++ b/scripts/build.sh @@ -4,7 +4,7 @@ cd "${0%/*}/.." source ./config/config.sh export PROP_SERVER_KEY=$(cat ./config/id_rsa) -export UI_MODE=cli +export UI_MODE=$1 docker build --build-arg UI_MODE \ --build-arg PROP_SERVER --build-arg PROP_SERVER_USER --build-arg PROP_SERVER_KEY \ - --build-arg PROP_DIR_SDR --build-arg PROP_DIR_DECODER -t registry.chrz.de:443/move2docker:$UI_MODE-latest-$(arch) . \ No newline at end of file + --build-arg PROP_DIR_SDR --build-arg PROP_DIR_DECODER -t registry.chrz.de:443/move2docker:$UI_MODE-$(arch) . \ No newline at end of file diff --git a/scripts/buildx.sh b/scripts/buildx.sh new file mode 100644 index 0000000..65b7831 --- /dev/null +++ b/scripts/buildx.sh @@ -0,0 +1,10 @@ +#!/bin/bash + +cd "${0%/*}/.." +source ./config/config.sh +export PROP_SERVER_KEY=$(cat ./config/id_rsa) + +export UI_MODE=$1 +docker buildx build --platform linux/amd64,linux/arm64,linux/arm/v7 --build-arg UI_MODE \ + --build-arg PROP_SERVER --build-arg PROP_SERVER_USER --build-arg PROP_SERVER_KEY \ + --build-arg PROP_DIR_SDR --build-arg PROP_DIR_DECODER -t move2docker:$UI_MODE-latest . \ No newline at end of file diff --git a/scripts/push.sh b/scripts/push.sh index 879e0ed..0639a1a 100644 --- a/scripts/push.sh +++ b/scripts/push.sh @@ -1,11 +1,4 @@ #!/bin/bash -docker tag registry.chrz.de:443/move2docker:cli-latest-$(arch) registry.chrz.de:443/move2docker:latest-$(arch) -docker push registry.chrz.de:443/move2docker:cli-latest-$(arch) -docker push registry.chrz.de:443/move2docker:gui-latest-$(arch) -docker push registry.chrz.de:443/move2docker:latest-$(arch) - -# docker manifest create registry.chrz.de:443/move2docker:latest registry.chrz.de:443/move2docker:latest-x86_64 registry.chrz.de:443/move2docker:latest-armv7l -# docker manifest annotate registry.chrz.de:443/move2docker:latest registry.chrz.de:443/move2docker:latest-x86_64 --os linux --arch amd64 -# docker manifest annotate registry.chrz.de:443/move2docker:latest registry.chrz.de:443/move2docker:latest-armv7l --os linux --arch armv7 -# docker manifest push registry.chrz.de:443/move2docker:latest --purge \ No newline at end of file +docker push registry.chrz.de:443/move2docker:cli-$(arch) +docker push registry.chrz.de:443/move2docker:gui-$(arch) \ No newline at end of file diff --git a/scripts/run.sh b/scripts/run.sh index b4237b9..6ba713d 100644 --- a/scripts/run.sh +++ b/scripts/run.sh @@ -1,3 +1,7 @@ #!/bin/bash -docker run -it --rm -v ./data:/app/data:rw --env DISPLAY=host.docker.internal:0.0 registry.chrz.de:443/move2docker:latest \ No newline at end of file +cd "${0%/*}/.." +source ./config/config.sh + +export UI_MODE=$1 +docker run -it --rm -v ./data:/app/data:rw --env DISPLAY=host.docker.internal:0.0 registry.chrz.de:443/move2docker:$UI_MODE-latest-$(arch) \ No newline at end of file