Skip to content

Commit

Permalink
Simplify Dockerfile and move to Ubuntu Noble
Browse files Browse the repository at this point in the history
Signed-off-by: Jose Luis Rivero <[email protected]>
  • Loading branch information
j-rivero committed Sep 2, 2024
1 parent 03994ee commit 5e55b3f
Showing 1 changed file with 18 additions and 43 deletions.
61 changes: 18 additions & 43 deletions docker/gz-transport/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
# Ubuntu 22.04
FROM ubuntu:jammy
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
Expand Down Expand Up @@ -31,62 +32,36 @@ RUN apt-get update \
tzdata \
&& apt-get clean

# Set USER and GROUP
ARG USER=developer
ARG GROUP=developer

# Add a user with the same user_id as the user outside the container
# Requires a docker build argument `user_id`.

RUN curl -SsL https://github.com/boxboat/fixuid/releases/download/v0.4/fixuid-0.4-linux-amd64.tar.gz | tar -C /usr/local/bin -xzf - && \
chown root:root /usr/local/bin/fixuid && \
chmod 4755 /usr/local/bin/fixuid && \
mkdir -p /etc/fixuid && \
printf "user: $USER\ngroup: $GROUP\n" > /etc/fixuid/config.yml

RUN addgroup --gid 1000 $USER && \
adduser --uid 1000 --ingroup $USER --home /home/$USER --shell /bin/sh --disabled-password --gecos "" $USER

RUN adduser $USER sudo \
&& echo "$USER ALL=NOPASSWD: ALL" >> /etc/sudoers.d/$USER

# Commands below run as the developer user.
USER $USER:$GROUP

# When running a container start in the developer's home folder.
WORKDIR /home/$USER

RUN export DEBIAN_FRONTEND=noninteractive \
&& sudo apt-get update \
&& sudo apt-get clean

# Install gazebo dependencies
RUN sudo /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' \
&& sudo /bin/sh -c 'wget http://packages.osrfoundation.org/gazebo.key -O - | sudo apt-key add -' \
&& sudo apt-get update \
&& sudo apt-get install -y \
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 'echo "deb [trusted=yes] http://packages.osrfoundation.org/gazebo/ubuntu-prerelease `lsb_release -cs` main" > /etc/apt/sources.list.d/gazebo-prerelease.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 \
&& sudo apt-get clean
&& apt-get clean

USER ubuntu
WORKDIR /tmp
# Gazebo transport
RUN git clone https://github.com/gazebosim/gz-transport.git -b gz-transport14 \
&& cd gz-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=/usr \
&& sudo make -j4 install \
&& cd ../..
&& cmake .. -DCMAKE_INSTALL_PREFIX=/tmp/gz-transport \
&& make -j4 install

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

WORKDIR /tmp/gz-transport/example/build

# Customize your image here.
# E.g.:
Expand Down

0 comments on commit 5e55b3f

Please sign in to comment.