diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..af27a2f --- /dev/null +++ b/.dockerignore @@ -0,0 +1,2 @@ +scripts/ +config/ \ No newline at end of file diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..2eea525 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +.env \ No newline at end of file diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..8fd4bce --- /dev/null +++ b/Dockerfile @@ -0,0 +1,47 @@ +# Secure temp download stage +FROM ubuntu:18.04 as intermediate +ENV DEBIAN_FRONTEND=noninteractive TZ=Europe/Berlin + +# Setup git +RUN apt-get update && \ + apt-get -y install git && \ + rm -rf /var/lib/apt/lists/* + +# Setup key and server for proprietary code +ARG PROP_SERVER +ARG PROP_SERVER_USER +ARG PROP_SERVER_KEY +RUN mkdir /root/.ssh/ && chmod 700 /root/.ssh && \ + echo "${PROP_SERVER_KEY}" > /root/.ssh/id_rsa && chmod 600 /root/.ssh/id_rsa && \ + echo "Host ${PROP_SERVER}" > /root/.ssh/config && echo " User ${PROP_SERVER_USER}" >> /root/.ssh/config && \ + echo " IdentityFile ~/.ssh/id_rsa" >> /root/.ssh/config && chmod 644 /root/.ssh/config && \ + touch /root/.ssh/known_hosts && chmod 644 /root/.ssh/known_hosts && \ + ssh-keyscan -H ${PROP_SERVER} >> /root/.ssh/known_hosts + +# Clone sources +ARG PROP_DIR_SDR +ARG PROP_DIR_DECODER +WORKDIR /app +RUN git clone https://github.com/MOVE-II/move2radio.git && \ + git clone git@${PROP_SERVER}:${PROP_DIR_SDR}/ldpc.git move2radio-prop/ldpc && \ + git clone git@${PROP_SERVER}:${PROP_DIR_SDR}/gr-ccsds.git move2radio-prop/gr-ccsds + +# Build stage +FROM ubuntu:18.04 +ENV DEBIAN_FRONTEND=noninteractive TZ=Europe/Berlin + +# Setup build deps +RUN apt-get update && \ + apt-get -y install build-essential git cmake python2.7 python-pip wget autoconf unzip libtool-bin pkgconf && \ + rm -rf /var/lib/apt/lists/* + +# Copy sources from download stage +COPY --from=intermediate /app /app + +# Build sources +WORKDIR /app/move2radio +RUN mkdir build && cd build && \ + cmake -DAPPIMAGE=OFF -DLDPC_OFFLINE=ON -DGR_CCSDS_OFFLINE=ON -DOFFLINE_DEPENDENCY_PATH=/app/move2radio-prop .. && \ + make build_gr_ccsds + +ENTRYPOINT ["/bin/bash"] \ No newline at end of file diff --git a/config/.gitignore b/config/.gitignore new file mode 100644 index 0000000..8601ab0 --- /dev/null +++ b/config/.gitignore @@ -0,0 +1,2 @@ +config.sh +id_rsa \ No newline at end of file diff --git a/config/README.md b/config/README.md new file mode 100644 index 0000000..22a268d --- /dev/null +++ b/config/README.md @@ -0,0 +1 @@ +Configure the proprietary code server using the file `config.sh` (see or copy `config.sh.example`), and place or link your private key for the server access here (`ìd_rsa`). Note that this key should not be protected with a password. \ No newline at end of file diff --git a/config/config.sh.example b/config/config.sh.example new file mode 100644 index 0000000..f5725e5 --- /dev/null +++ b/config/config.sh.example @@ -0,0 +1,4 @@ +export PROP_SERVER=gitlab.lrz.de +export PROP_SERVER_USER=ga123xyz +export PROP_DIR_SDR=sdr +export PROP_DIR_DECODER=mondbaron \ No newline at end of file diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..be4300d --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,12 @@ +version: '3' + +services: + move2: + build: + context: . + args: + - PROP_SERVER + - PROP_SERVER_USER + - PROP_SERVER_KEY + - PROP_DIR_SDR + - PROP_DIR_DECODER \ No newline at end of file diff --git a/scripts/build.sh b/scripts/build.sh new file mode 100644 index 0000000..7f830d0 --- /dev/null +++ b/scripts/build.sh @@ -0,0 +1,6 @@ +#!/bin/bash + +cd "${0%/*}/.." +source ./config/config.sh +export PROP_SERVER_KEY=$(cat ./config/id_rsa) +docker-compose build \ No newline at end of file