From 3a8126b997f1db8fb1ec1041f61bca3e64955dac Mon Sep 17 00:00:00 2001 From: Hoang Tung Dinh Date: Thu, 22 Aug 2024 09:34:31 +0200 Subject: [PATCH] Update demo pipeline with the new package distribution system (#131) Signed-off-by: hoangtungdinh <11166240+hoangtungdinh@users.noreply.github.com> --- demo_pipeline/otxBundle | 4 +- demo_pipeline/xodrBundle | 4 +- demo_pipeline/xoscBundle | 4 +- doc/manual/demo_pipeline.md | 6 +-- docker/Dockerfile.linux | 77 ++++++++++--------------------------- 5 files changed, 25 insertions(+), 70 deletions(-) diff --git a/demo_pipeline/otxBundle b/demo_pipeline/otxBundle index 14d92309..c9fee913 100644 --- a/demo_pipeline/otxBundle +++ b/demo_pipeline/otxBundle @@ -6,7 +6,5 @@ # with this file, You can obtain one at https://mozilla.org/MPL/2.0/. readonly CONFIG_FILE=$1 -source /app/otx-venv/bin/activate -cd /app/qc-otx -python main.py -c $CONFIG_FILE +qc_otx -c $CONFIG_FILE cp *.xqar /app/framework/bin/ diff --git a/demo_pipeline/xodrBundle b/demo_pipeline/xodrBundle index 8376b70f..953f6a43 100644 --- a/demo_pipeline/xodrBundle +++ b/demo_pipeline/xodrBundle @@ -6,7 +6,5 @@ # with this file, You can obtain one at https://mozilla.org/MPL/2.0/. readonly CONFIG_FILE=$1 -source /app/opendrive-venv/bin/activate -cd /app/qc-opendrive -python main.py -c $CONFIG_FILE +qc_opendrive -c $CONFIG_FILE cp *.xqar /app/framework/bin/ diff --git a/demo_pipeline/xoscBundle b/demo_pipeline/xoscBundle index 44f896ea..602477b4 100644 --- a/demo_pipeline/xoscBundle +++ b/demo_pipeline/xoscBundle @@ -6,7 +6,5 @@ # with this file, You can obtain one at https://mozilla.org/MPL/2.0/. readonly CONFIG_FILE=$1 -source /app/openscenario-venv/bin/activate -cd /app/qc-openscenarioxml -python main.py -c $CONFIG_FILE +qc_openscenario -c $CONFIG_FILE cp *.xqar /app/framework/bin/ diff --git a/doc/manual/demo_pipeline.md b/doc/manual/demo_pipeline.md index da8c1431..3008241e 100644 --- a/doc/manual/demo_pipeline.md +++ b/doc/manual/demo_pipeline.md @@ -154,11 +154,9 @@ docker pull ghcr.io/asam-ev/qc-framework:demo-pipeline-latest ### Local build instructions -The image can only be built on Linux. To build the Docker image locally, you can execute: - -``` -cd .. +The image can only be built on Linux. To build the Docker image locally, you can execute the following command from the root folder of the repository. +```bash DOCKER_BUILDKIT=1 \ docker build \ -f docker/Dockerfile.linux \ diff --git a/docker/Dockerfile.linux b/docker/Dockerfile.linux index 71d191d2..0579e9e1 100644 --- a/docker/Dockerfile.linux +++ b/docker/Dockerfile.linux @@ -19,7 +19,7 @@ RUN echo "Installing Dependencies..." && \ libqt5xmlpatterns5-dev \ libxerces-c-dev \ pkg-config \ - python3.10-venv \ + python3-pip \ git && \ echo "Dependencies installed." @@ -51,44 +51,22 @@ RUN echo "Building framework..." && \ echo "Done." -# Clone, configure venv, install by copying bash script to install dir - OpenSCENARIO -RUN git clone --single-branch --branch develop https://github.com/asam-ev/qc-openscenarioxml.git && \ - python3 -m venv openscenario-venv && \ - source openscenario-venv/bin/activate && \ - python3 -m pip install --no-cache-dir -r qc-openscenarioxml/requirements.txt && \ - chmod +x /app/demo_pipeline/xoscBundle && \ +# Copy bash script to install dir - OpenSCENARIO + OpenDRIVE + OTX +RUN chmod +x /app/demo_pipeline/xoscBundle && \ cp /app/demo_pipeline/xoscBundle /home/root/qc-build/bin/xoscBundle && \ - rm -rf /app/qc-openscenarioxml/.git - -# Clone, configure venv, install by copying bash script to install dir - OpenDRIVE -RUN git clone --single-branch --branch develop https://github.com/asam-ev/qc-opendrive.git && \ - python3 -m venv opendrive-venv && \ - source opendrive-venv/bin/activate && \ - python3 -m pip install --no-cache-dir -r qc-opendrive/requirements.txt && \ chmod +x /app/demo_pipeline/xodrBundle && \ cp /app/demo_pipeline/xodrBundle /home/root/qc-build/bin/xodrBundle && \ - rm -rf /app/qc-opendrive/.git - -# Clone, configure venv, install by copying bash script to install dir - OTX -RUN git clone --single-branch --branch develop https://github.com/asam-ev/qc-otx.git && \ - python3 -m venv otx-venv && \ - source otx-venv/bin/activate && \ - python3 -m pip install --no-cache-dir -r qc-otx/requirements.txt && \ chmod +x /app/demo_pipeline/otxBundle && \ - cp /app/demo_pipeline/otxBundle /home/root/qc-build/bin/otxBundle && \ - rm -rf /app/qc-otx/.git - -# Create and setup demo and runtime virtual envs -RUN python3 -m venv demo-pipeline-venv && \ - source demo-pipeline-venv/bin/activate && \ - python3 -m pip install --no-cache-dir -r /app/demo_pipeline/requirements.txt - -RUN python3 -m venv runtime-venv && \ - source runtime-venv/bin/activate && \ - python3 -m pip install --no-cache-dir -r /app/framework/runtime/requirements.txt - - -# Runtime stage + cp /app/demo_pipeline/otxBundle /home/root/qc-build/bin/otxBundle + +RUN python3 -m pip install --no-cache-dir -r /app/demo_pipeline/requirements.txt && \ + python3 -m pip install --no-cache-dir -r /app/framework/runtime/requirements.txt && \ + python3 -m pip install asam-qc-opendrive@git+https://github.com/asam-ev/qc-opendrive@develop && \ + python3 -m pip install asam-qc-openscenarioxml@git+https://github.com/asam-ev/qc-openscenarioxml@develop && \ + python3 -m pip install asam-qc-otx@git+https://github.com/asam-ev/qc-otx@develop + + +# Runtime test stage FROM ubuntu:22.04 as runtime_test # Dependancies installation currently required by ResultPooling and TextReport modules @@ -109,14 +87,15 @@ COPY --from=framework_builder /home/root/qc-build/bin /app/framework/bin COPY --from=framework_builder /app/framework/build/test /app/framework/test # @NOTE this is just because DemoCheckerBundle is not installed by default COPY --from=framework_builder /app/framework/build/examples/checker_bundle_example/DemoCheckerBundle /app/framework/bin/ -# Virtual envs -COPY --from=framework_builder /app/runtime-venv /app/runtime-venv WORKDIR /app/framework/runtime/ SHELL ["/bin/bash", "-c"] -CMD source /app/runtime-venv/bin/activate && python3 -m pytest -rA > runtime_test.log && cp /app/framework/runtime/runtime_test.log /out/runtime_test.log +COPY --from=framework_builder /usr/local/lib/python3.10/dist-packages /usr/local/lib/python3.10/dist-packages +COPY --from=framework_builder /usr/local/bin /usr/local/bin + +CMD python3 -m pytest -rA > runtime_test.log && cp /app/framework/runtime/runtime_test.log /out/runtime_test.log # Runtime stage FROM framework_builder as unit_test @@ -137,13 +116,6 @@ RUN apt update && apt install -y \ RUN mkdir -p /app -# Virtual envs -COPY --from=framework_builder /app/runtime-venv /app/runtime-venv -COPY --from=framework_builder /app/demo-pipeline-venv /app/demo-pipeline-venv -COPY --from=framework_builder /app/opendrive-venv /app/opendrive-venv -COPY --from=framework_builder /app/openscenario-venv /app/openscenario-venv -COPY --from=framework_builder /app/otx-venv /app/otx-venv - # Framework components COPY --from=framework_builder /home/root/qc-build/bin /app/framework/bin COPY --from=framework_builder /app/demo_pipeline /app/demo_pipeline @@ -152,18 +124,9 @@ COPY --from=framework_builder /app/framework/runtime /app/framework/runtime # Framework schemas COPY --from=framework_builder /app/framework/doc/schema /app/framework/doc/schema -# OpenScenario XML checker bundle -COPY --from=framework_builder /app/qc-openscenarioxml/main.py /app/qc-openscenarioxml/main.py -COPY --from=framework_builder /app/qc-openscenarioxml/qc_openscenario /app/qc-openscenarioxml/qc_openscenario - -# OpenDrive XML checker bundle -COPY --from=framework_builder /app/qc-opendrive/main.py /app/qc-opendrive/main.py -COPY --from=framework_builder /app/qc-opendrive/qc_opendrive /app/qc-opendrive/qc_opendrive - -# OTX XML checker bundle -COPY --from=framework_builder /app/qc-otx/main.py /app/qc-otx/main.py -COPY --from=framework_builder /app/qc-otx/qc_otx /app/qc-otx/qc_otx +COPY --from=framework_builder /usr/local/lib/python3.10/dist-packages /usr/local/lib/python3.10/dist-packages +COPY --from=framework_builder /usr/local/bin /usr/local/bin SHELL ["/bin/bash", "-c"] -CMD source /app/demo-pipeline-venv/bin/activate && /app/demo_pipeline/run_pipeline.sh +CMD /app/demo_pipeline/run_pipeline.sh