From 4e308d14eb174b87925edfe0ab32af7d5875b300 Mon Sep 17 00:00:00 2001 From: Maksim Derbasov Date: Wed, 9 Oct 2024 23:43:05 +0900 Subject: [PATCH 1/7] Fix docker build Signed-off-by: Maksim Derbasov --- .dockerignore | 4 ++++ docker/Dockerfile.base | 4 +--- docker/Dockerfile.nightly | 6 ++++-- docker/README.md | 10 ++++++---- docker/scripts/enable_gcc8.sh | 17 ----------------- docker/scripts/install_common_deps.sh | 14 ++++++++------ 6 files changed, 23 insertions(+), 32 deletions(-) delete mode 100755 docker/scripts/enable_gcc8.sh diff --git a/.dockerignore b/.dockerignore index 2286ab6ad9..5f9332b82b 100644 --- a/.dockerignore +++ b/.dockerignore @@ -1,2 +1,6 @@ +.git +.github +.vscode build build_* + diff --git a/docker/Dockerfile.base b/docker/Dockerfile.base index 37e7b94eff..6a25be9256 100644 --- a/docker/Dockerfile.base +++ b/docker/Dockerfile.base @@ -1,4 +1,4 @@ -FROM ubuntu:focal +FROM ubuntu:jammy RUN apt-get update \ && apt-get install -y \ @@ -11,5 +11,3 @@ RUN scripts/enable_stable.sh COPY docker/scripts/install_common_deps.sh scripts/install_common_deps.sh RUN scripts/install_common_deps.sh -COPY docker/scripts/enable_gcc8.sh scripts/enable_gcc8.sh -RUN scripts/enable_gcc8.sh diff --git a/docker/Dockerfile.nightly b/docker/Dockerfile.nightly index 4dee43a1d5..de65335e3d 100644 --- a/docker/Dockerfile.nightly +++ b/docker/Dockerfile.nightly @@ -10,7 +10,7 @@ COPY docker/scripts/enable_nightly.sh scripts/enable_nightly.sh RUN scripts/enable_nightly.sh RUN apt-get update \ - && apt-get install -y \ + && apt-get install --no-install-recommends -y \ libgz-cmake4-dev \ libgz-common6-dev \ libgz-fuel-tools10-dev \ @@ -23,7 +23,9 @@ RUN apt-get update \ libgz-gui9-dev \ libgz-msgs11-dev \ libgz-sensors9-dev \ - libsdformat15-dev + libsdformat15-dev \ + && apt-get clean \ + && rm -rf /var/lib/apt/lists/* COPY . gz-sim RUN cd gz-sim \ diff --git a/docker/README.md b/docker/README.md index b641ee83bb..b098582a69 100644 --- a/docker/README.md +++ b/docker/README.md @@ -17,6 +17,8 @@ use the Gazebo code found in the current source tree. 1. [Install Docker](#Install-Docker) + You need at least 10Gb or free space on a hard drive. + 1. *Optional:* [Install NVidia Docker](#Install-Nvidia-Docker) Nvidia docker will be needed if you plan to run the GUI and/or sensors @@ -46,7 +48,7 @@ use the Gazebo code found in the current source tree. 3. Run the docker image with a bash shell. ``` - docker run -it gz-sim:nightly /bin/bash + docker run --rm -it gz-sim:nightly /bin/bash ``` 4. Alternatively, you can directly run Gazebo using @@ -73,21 +75,21 @@ distribution using debians. image of Gazebo Garden: ``` - ./build.bash gz-garden ./Dockerfile.gz + ./build.bash gz ./Dockerfile.gz ``` 2. Run the docker image using `run.bash`, and pass in the name of the docker image (first argument to the build.bash script). ``` - ./run.bash gz-garden + ./run.bash gz ``` 3. You can pass arguments to Gazebo by appending them the `run.bash` command. For example, to load the shapes.sdf file: ``` - ./run.bash gz-garden -f shapes.sdf + ./run.bash gz -f shapes.sdf ``` ## Appendix diff --git a/docker/scripts/enable_gcc8.sh b/docker/scripts/enable_gcc8.sh deleted file mode 100755 index 645ab728e4..0000000000 --- a/docker/scripts/enable_gcc8.sh +++ /dev/null @@ -1,17 +0,0 @@ -#!/bin/bash - -set -o errexit -set -o verbose - -sudo apt-get install g++-8 - -sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-8 800 --slave /usr/bin/g++ g++ /usr/bin/g++-8 --slave /usr/bin/gcov gcov /usr/bin/gcov-8 - -gcc -v -g++ -v -gcov -v - -# lcov -git clone https://github.com/linux-test-project/lcov.git -b v1.14 -cd lcov -sudo make install diff --git a/docker/scripts/install_common_deps.sh b/docker/scripts/install_common_deps.sh index 4557350cf2..ed09176535 100755 --- a/docker/scripts/install_common_deps.sh +++ b/docker/scripts/install_common_deps.sh @@ -17,16 +17,18 @@ sudo apt-get install --no-install-recommends -y \ cppcheck \ curl \ git \ - g++-8 \ - pkg-config \ + g++11 \ + lcov \ + pkg-config sudo apt-get install --no-install-recommends -y \ - clang-tidy-6.0 \ - python-yaml \ - libclang-6.0-dev + clang-tidy-14 \ + python3-yaml sudo apt-get install --no-install-recommends -y \ libbenchmark-dev \ libbenchmark1 -sudo apt-get clean && sudo rm -rf /var/lib/apt/lists/* +sudo apt-get clean +sudo rm -rf /var/lib/apt/lists/* + From 15088de4c1175a3e32fdd08815ca1ba9b38ae6ad Mon Sep 17 00:00:00 2001 From: Maksim Derbasov Date: Thu, 10 Oct 2024 21:54:16 +0900 Subject: [PATCH 2/7] Iteration Signed-off-by: Maksim Derbasov --- .dockerignore | 1 - docker/Dockerfile.base | 1 - docker/README.md | 2 +- docker/scripts/install_common_deps.sh | 1 - 4 files changed, 1 insertion(+), 4 deletions(-) diff --git a/.dockerignore b/.dockerignore index 5f9332b82b..72a1f8649a 100644 --- a/.dockerignore +++ b/.dockerignore @@ -3,4 +3,3 @@ .vscode build build_* - diff --git a/docker/Dockerfile.base b/docker/Dockerfile.base index 6a25be9256..32d6612ec2 100644 --- a/docker/Dockerfile.base +++ b/docker/Dockerfile.base @@ -10,4 +10,3 @@ RUN scripts/enable_stable.sh COPY docker/scripts/install_common_deps.sh scripts/install_common_deps.sh RUN scripts/install_common_deps.sh - diff --git a/docker/README.md b/docker/README.md index b098582a69..5d0ac8a4cd 100644 --- a/docker/README.md +++ b/docker/README.md @@ -17,7 +17,7 @@ use the Gazebo code found in the current source tree. 1. [Install Docker](#Install-Docker) - You need at least 10Gb or free space on a hard drive. + You need at least 10GB or free space on a hard drive. 1. *Optional:* [Install NVidia Docker](#Install-Nvidia-Docker) diff --git a/docker/scripts/install_common_deps.sh b/docker/scripts/install_common_deps.sh index ed09176535..63345daf89 100755 --- a/docker/scripts/install_common_deps.sh +++ b/docker/scripts/install_common_deps.sh @@ -31,4 +31,3 @@ sudo apt-get install --no-install-recommends -y \ sudo apt-get clean sudo rm -rf /var/lib/apt/lists/* - From d5bf100ae00faebb964c3a856cbbc3d54bcf068f Mon Sep 17 00:00:00 2001 From: Maksim Derbasov Date: Sat, 9 Nov 2024 01:07:13 +0900 Subject: [PATCH 3/7] Iteration Signed-off-by: Maksim Derbasov --- docker/Dockerfile.base | 2 +- docker/Dockerfile.nightly | 2 +- docker/README.md | 4 ++-- docker/run.bash | 14 ++------------ docker/scripts/install_common_deps.sh | 6 +++--- 5 files changed, 9 insertions(+), 19 deletions(-) diff --git a/docker/Dockerfile.base b/docker/Dockerfile.base index 32d6612ec2..490764ffa5 100644 --- a/docker/Dockerfile.base +++ b/docker/Dockerfile.base @@ -1,4 +1,4 @@ -FROM ubuntu:jammy +FROM ubuntu:noble RUN apt-get update \ && apt-get install -y \ diff --git a/docker/Dockerfile.nightly b/docker/Dockerfile.nightly index de65335e3d..63316c6950 100644 --- a/docker/Dockerfile.nightly +++ b/docker/Dockerfile.nightly @@ -10,7 +10,7 @@ COPY docker/scripts/enable_nightly.sh scripts/enable_nightly.sh RUN scripts/enable_nightly.sh RUN apt-get update \ - && apt-get install --no-install-recommends -y \ + && apt-get install -y \ libgz-cmake4-dev \ libgz-common6-dev \ libgz-fuel-tools10-dev \ diff --git a/docker/README.md b/docker/README.md index 5d0ac8a4cd..9aea22d8c0 100644 --- a/docker/README.md +++ b/docker/README.md @@ -54,7 +54,7 @@ use the Gazebo code found in the current source tree. 4. Alternatively, you can directly run Gazebo using ``` - ./docker/run.bash gz-sim:nightly gz-sim-server -v 4 + ./docker/run.bash gz-sim:nightly gz sim -v 4 ``` ## Gazebo Using Debians In Docker @@ -75,7 +75,7 @@ distribution using debians. image of Gazebo Garden: ``` - ./build.bash gz ./Dockerfile.gz + ./build.bash gz-ionic ./Dockerfile.gz ``` 2. Run the docker image using `run.bash`, and pass in the name of the docker diff --git a/docker/run.bash b/docker/run.bash index cf2ffe4291..bb4eaece9f 100755 --- a/docker/run.bash +++ b/docker/run.bash @@ -18,17 +18,8 @@ ARGS=("$@") # This is necessary so Gazebo can create a context for OpenGL rendering # (even headless). XAUTH=/tmp/.docker.xauth -if [ ! -f $XAUTH ] -then - xauth_list=$(xauth nlist :0 | sed -e 's/^..../ffff/') - if [ ! -z "$xauth_list" ] - then - echo $xauth_list | xauth -f $XAUTH nmerge - - else - touch $XAUTH - fi - chmod a+r $XAUTH -fi +xauth nlist $DISPLAY | sed -e 's/^..../ffff/' | xauth -f $XAUTH nmerge - +chmod 777 $XAUTH docker run -it \ -e DISPLAY \ @@ -40,7 +31,6 @@ docker run -it \ -v "/etc/localtime:/etc/localtime:ro" \ -v "/dev/input:/dev/input" \ --rm \ - --gpus all \ --security-opt seccomp=unconfined \ $IMG \ ${@:2} diff --git a/docker/scripts/install_common_deps.sh b/docker/scripts/install_common_deps.sh index 63345daf89..e5fd13ae68 100755 --- a/docker/scripts/install_common_deps.sh +++ b/docker/scripts/install_common_deps.sh @@ -17,17 +17,17 @@ sudo apt-get install --no-install-recommends -y \ cppcheck \ curl \ git \ - g++11 \ + g++ \ lcov \ pkg-config sudo apt-get install --no-install-recommends -y \ - clang-tidy-14 \ + clang-tidy \ python3-yaml sudo apt-get install --no-install-recommends -y \ libbenchmark-dev \ - libbenchmark1 + libbenchmark1.8.3 sudo apt-get clean sudo rm -rf /var/lib/apt/lists/* From fec291ba0cce8da78ce8528ebc27a32dda94e82d Mon Sep 17 00:00:00 2001 From: Maksim Derbasov Date: Sat, 9 Nov 2024 03:58:29 +0900 Subject: [PATCH 4/7] Iteration Signed-off-by: Maksim Derbasov --- docker/README.md | 6 +++--- docker/run.bash | 1 + 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/docker/README.md b/docker/README.md index 9aea22d8c0..b038c709a8 100644 --- a/docker/README.md +++ b/docker/README.md @@ -75,21 +75,21 @@ distribution using debians. image of Gazebo Garden: ``` - ./build.bash gz-ionic ./Dockerfile.gz + ./build.bash gz-garden ./Dockerfile.gz ``` 2. Run the docker image using `run.bash`, and pass in the name of the docker image (first argument to the build.bash script). ``` - ./run.bash gz + ./run.bash gz-garden ``` 3. You can pass arguments to Gazebo by appending them the `run.bash` command. For example, to load the shapes.sdf file: ``` - ./run.bash gz -f shapes.sdf + ./run.bash gz-garden -f shapes.sdf ``` ## Appendix diff --git a/docker/run.bash b/docker/run.bash index bb4eaece9f..7d36a02be8 100755 --- a/docker/run.bash +++ b/docker/run.bash @@ -31,6 +31,7 @@ docker run -it \ -v "/etc/localtime:/etc/localtime:ro" \ -v "/dev/input:/dev/input" \ --rm \ + --gpus all \ --security-opt seccomp=unconfined \ $IMG \ ${@:2} From d83556e9fa4d8bb66582edecc11009fdd2359c8e Mon Sep 17 00:00:00 2001 From: Maksim Derbasov Date: Fri, 22 Nov 2024 00:55:37 +0900 Subject: [PATCH 5/7] Regular Docker build Signed-off-by: Maksim Derbasov --- .github/workflows/docker-nightly.yml | 33 ++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 .github/workflows/docker-nightly.yml diff --git a/.github/workflows/docker-nightly.yml b/.github/workflows/docker-nightly.yml new file mode 100644 index 0000000000..0c09b0ba60 --- /dev/null +++ b/.github/workflows/docker-nightly.yml @@ -0,0 +1,33 @@ +name: nightly docker image builds + +on: + push: + schedule: + - cron: '0 6 * * *' + +jobs: + main: + runs-on: ubuntu-latest + steps: + - uses: docker/setup-buildx-action@v3 + with: + driver: docker + - uses: actions/checkout@v4 + with: + repository: gazebosim/gz-sim + ref: gz-sim9 + path: src + - name: build base image + uses: docker/build-push-action@v6 + with: + file: src/docker/Dockerfile.base + context: src + tags: gz-sim:base + load: true + - name: build nightly image + uses: docker/build-push-action@v6 + with: + file: src/docker/Dockerfile.nightly + build-contexts: | + gz-sim:base=docker-image://gz-sim:base + context: src From 309f3667f03bc64756ccec297a2e9d276af61ad2 Mon Sep 17 00:00:00 2001 From: Maksim Derbasov Date: Sat, 14 Dec 2024 02:15:37 +0900 Subject: [PATCH 6/7] Iteration Signed-off-by: Maksim Derbasov --- docker/run.bash | 13 +++++++++++-- docker/scripts/install_common_deps.sh | 4 ---- 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/docker/run.bash b/docker/run.bash index 7d36a02be8..e6e68937bd 100755 --- a/docker/run.bash +++ b/docker/run.bash @@ -18,8 +18,17 @@ ARGS=("$@") # This is necessary so Gazebo can create a context for OpenGL rendering # (even headless). XAUTH=/tmp/.docker.xauth -xauth nlist $DISPLAY | sed -e 's/^..../ffff/' | xauth -f $XAUTH nmerge - -chmod 777 $XAUTH +if [ ! -f $XAUTH ] +then + xauth_list=$(xauth nlist $DISPLAY | sed -e 's/^..../ffff/') + if [ ! -z "$xauth_list" ] + then + echo $xauth_list | xauth -f $XAUTH nmerge - + else + touch $XAUTH + fi + chmod a+r $XAUTH +fi docker run -it \ -e DISPLAY \ diff --git a/docker/scripts/install_common_deps.sh b/docker/scripts/install_common_deps.sh index e5fd13ae68..4310e0d046 100755 --- a/docker/scripts/install_common_deps.sh +++ b/docker/scripts/install_common_deps.sh @@ -25,9 +25,5 @@ sudo apt-get install --no-install-recommends -y \ clang-tidy \ python3-yaml -sudo apt-get install --no-install-recommends -y \ - libbenchmark-dev \ - libbenchmark1.8.3 - sudo apt-get clean sudo rm -rf /var/lib/apt/lists/* From 91acee9c73a5e16b1d1e537c2faa6c4f0c4f7057 Mon Sep 17 00:00:00 2001 From: Maksim Derbasov Date: Sat, 14 Dec 2024 23:47:27 +0900 Subject: [PATCH 7/7] Iteration Signed-off-by: Maksim Derbasov --- docker/scripts/install_common_deps.sh | 4 ++++ test/benchmark/README.md | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/docker/scripts/install_common_deps.sh b/docker/scripts/install_common_deps.sh index 4310e0d046..1b8d637599 100755 --- a/docker/scripts/install_common_deps.sh +++ b/docker/scripts/install_common_deps.sh @@ -25,5 +25,9 @@ sudo apt-get install --no-install-recommends -y \ clang-tidy \ python3-yaml +# for benchmarks in gz-sim/test/benchmark +sudo apt-get install --no-install-recommends -y \ + libbenchmark-dev + sudo apt-get clean sudo rm -rf /var/lib/apt/lists/* diff --git a/test/benchmark/README.md b/test/benchmark/README.md index d73688846d..d5b1d938a1 100644 --- a/test/benchmark/README.md +++ b/test/benchmark/README.md @@ -14,7 +14,7 @@ Given a set of changes to the codebase, it is often useful to see the difference in performance. -Once two (or more) benchmarks have been executed, compare the results by downloading the [benchmark tools](https://github.com/google/benchmark/tree/master/tools), and then run the following command: +Once two (or more) benchmarks have been executed, compare the results by downloading the [benchmark tools](https://github.com/google/benchmark/tree/main/tools), and then run the following command: ``` # From the downloaded "tools" folder