Skip to content

Commit

Permalink
Simplify the relay tutorial docker setup (#530)
Browse files Browse the repository at this point in the history
Removed build.sh and run.sh scripts that were really not
needed to just run the relay example. Modify the
instructions accordingly.

---------
Signed-off-by: Jose Luis Rivero <[email protected]>
  • Loading branch information
j-rivero authored Sep 4, 2024
1 parent 2ddd4c8 commit 591c313
Show file tree
Hide file tree
Showing 5 changed files with 70 additions and 239 deletions.
67 changes: 67 additions & 0 deletions docker/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
# Ubuntu 24.04
FROM ubuntu:noble

ENV TZ=America/Los_Angeles
ENV DEBIAN_FRONTEND=noninteractive
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone

# Tools I find useful during development
RUN apt-get update \
&& apt-get install -y \
cmake \
pkg-config \
cppcheck \
git \
mercurial \
build-essential \
curl \
libprotobuf-dev \
protobuf-compiler \
libprotoc-dev \
libzmq3-dev \
net-tools \
uuid-dev \
doxygen \
ruby-ronn \
libsqlite3-dev \
python3-pybind11 \
sudo \
gnupg \
lsb-release \
wget \
tzdata \
&& apt-get clean

# Install gazebo dependencies
RUN /bin/sh -c 'echo "deb [trusted=yes] http://packages.osrfoundation.org/gazebo/ubuntu-stable `lsb_release -cs` main" > /etc/apt/sources.list.d/gazebo-stable.list' \
&& /bin/sh -c 'wget http://packages.osrfoundation.org/gazebo.key -O - | apt-key add -' \
&& apt-get update \
&& apt-get install -y \
libgz-cmake4-dev \
libgz-math8-dev \
libgz-msgs11-dev \
libgz-utils3-cli-dev \
&& apt-get clean

USER ubuntu
WORKDIR /tmp
# Gazebo transport
RUN git clone https://github.com/gazebosim/gz-transport.git -b gz-transport14
RUN cd gz-transport \
&& mkdir build \
&& cd build \
&& cmake .. -DCMAKE_INSTALL_PREFIX=/tmp/gz-transport \
&& make -j4 install

# Gazebo transport examples
RUN cd gz-transport/example \
&& mkdir build \
&& cd build \
&& cmake .. -DCMAKE_INSTALL_PREFIX=/tmp/gz-transport \
&& make -j4

WORKDIR /tmp/gz-transport/example/build

# Customize your image here.
# E.g.:
# ENV PATH="/opt/sublime_text:$PATH"
44 changes: 0 additions & 44 deletions docker/build.bash

This file was deleted.

93 changes: 0 additions & 93 deletions docker/gz-transport/Dockerfile

This file was deleted.

91 changes: 0 additions & 91 deletions docker/run.bash

This file was deleted.

14 changes: 3 additions & 11 deletions tutorials/08_relay.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,25 +29,17 @@ Download the [build.bash](https://github.com/gazebosim/gz-transport/raw/gz-trans
[Dockerfile](https://github.com/gazebosim/gz-transport/raw/gz-transport14/docker/gz-transport/Dockerfile) files.

```{.sh}
wget https://github.com/gazebosim/gz-transport/raw/gz-transport14/docker/build.bash
wget https://github.com/gazebosim/gz-transport/raw/gz-transport14/docker/run.bash
mkdir gz-transport && wget https://github.com/gazebosim/gz-transport/raw/gz-transport14/docker/gz-transport/Dockerfile -O gz-transport/Dockerfile
chmod +x build.bash run.bash
wget https://github.com/gazebosim/gz-transport/raw/gz-transport14/docker/gz-transport/Dockerfile -O Dockerfile
```

Now, it's time to build the Docker image:
```
./build.bash gz-transport
docker build -t gz-transport-relay - < Dockerfile
```

Run your Docker container:
```
./run.bash gz-transport
```

Inside the docker instance, go to the `example` directory:
```
cd gz-transport/example/build
docker run -it --rm gz-transport-relay /bin/bash
```

Back on your host, make sure that you have Gazebo Tools and net-tools
Expand Down

0 comments on commit 591c313

Please sign in to comment.