From 76e58110d4ef0f8e5868385b2bc9dd01344ecb92 Mon Sep 17 00:00:00 2001 From: Joao Figueiredo Date: Tue, 24 Sep 2024 18:04:42 +0100 Subject: [PATCH] Add new build file that creates docker container and builds the code --- README.md | 3 +++ images/dev/Dockerfile | 3 ++- scripts/build-inside-container.sh | 26 ++++++++++++++++++++++++++ 3 files changed, 31 insertions(+), 1 deletion(-) create mode 100755 scripts/build-inside-container.sh diff --git a/README.md b/README.md index 6d9ac93..5907a03 100644 --- a/README.md +++ b/README.md @@ -111,3 +111,6 @@ Open `cpp/demos/ossrf-nmos-api/config/nmos_config.json` and adjust the following `./build/Debug/cpp/demos/ossrf-nmos-api/ossrf-nmos-api -f ./cpp/demos/ossrf-nmos-api/config/nmos_config.json` +## Build Container and Code simultaneously + + ./scripts/build-inside-container.sh diff --git a/images/dev/Dockerfile b/images/dev/Dockerfile index 7fc13e4..a8ba976 100644 --- a/images/dev/Dockerfile +++ b/images/dev/Dockerfile @@ -2,7 +2,7 @@ FROM ubuntu:22.04 # Versions ENV CONAN_VERSION=2.4.0 -ENV CMAKE_VERSION=3.27.0 +ENV CMAKE_VERSION=3.28.4 ENV SSHD_PORT=55555 @@ -23,6 +23,7 @@ RUN /opt/bisect/scripts/build-tools/install-cmake-x86.sh RUN apt-get install -y \ vim clang-format rsync gdb gdbserver x11-apps xauth iproute2 build-essential RUN apt-get install -y libgtk-3-dev ninja-build +ENV PATH="/opt/cmake/bin:${PATH}" RUN /opt/bisect/scripts/common/add-ssh-server.sh diff --git a/scripts/build-inside-container.sh b/scripts/build-inside-container.sh new file mode 100755 index 0000000..bb201e9 --- /dev/null +++ b/scripts/build-inside-container.sh @@ -0,0 +1,26 @@ +#!/bin/bash + +set -eu + +SCRIPT_DIR="$(realpath "$(dirname "$0")")" +PROJECT_DIR=${SCRIPT_DIR}/.. + +docker compose -f ${PROJECT_DIR}/images/docker-compose-x86-development.yml build +docker compose -f ${PROJECT_DIR}/images/docker-compose-x86-development.yml up -d + +CONTAINER_NAME="images-ossrf-dev-1" + +until docker exec -it $CONTAINER_NAME true > /dev/null 2>&1; do + echo "Waiting for container $CONTAINER_NAME to start..." + sleep 2 +done + +docker exec -it $CONTAINER_NAME bash -c " + git clone https://github.com/AMWA-TV/nmos-sender-receiver-framework.git + cd nmos-sender-receiver-framework + conan profile detect + ./scripts/setup.sh + ./scripts/build.sh +" + +docker exec -it $CONTAINER_NAME fish -C "cd /home/nmos/nmos-sender-receiver-framework"