Skip to content

Instantly share code, notes, and snippets.

@j-rivero
Created July 19, 2017 00:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save j-rivero/f9fa4fa0f4ac1bdb6dc661baa8e292b6 to your computer and use it in GitHub Desktop.
Save j-rivero/f9fa4fa0f4ac1bdb6dc661baa8e292b6 to your computer and use it in GitHub Desktop.
gazebo_experimental Dockerfile
FROM ubuntu:16.04
# This is a dockerfile for building gazebo_experimental
# Build:
# - docker build --build-arg user_id=$EUID --tag gazebo_experimental .
# Run:
# - nvidia-docker run -i -t -v /home/$USER:/home/developer gazebo_experimental /bin/bash
# Need these to do useful stuff below
RUN apt-get update \
&& apt-get install -y \
wget \
lsb-release \
sudo \
mercurial \
vim \
gdb \
valgrind \
autotools-dev \
automake \
&& apt-get clean
# Install gazebo dependencies
# see http://gazebosim.org/tutorials?tut=install_from_source
RUN echo "deb http://packages.osrfoundation.org/gazebo/ubuntu-stable `lsb_release -cs` main" > /etc/apt/sources.list.d/gazebo-stable.list
RUN wget http://packages.osrfoundation.org/gazebo.key -O - | apt-key add -
RUN wget https://bitbucket.org/osrf/release-tools/raw/default/jenkins-scripts/lib/dependencies_archive.sh -O /tmp/dependencies.sh
# Required and optional dependencies
# Strips ignition and sdformat so they can be built from source
RUN bash -c 'ROS_DISTRO=Dummy GAZEBO_EXPERIMENTAL_BUILD=true source /tmp/dependencies.sh \
&& apt-get update \
&& deps=" \
$BASE_DEPENDENCIES \
$GAZEBO_BASE_DEPENDENCIES \
$GAZEBO_EXTRA_DEPENDENCIES \
$SDFORMAT_BASE_DEPENDENCIES \
$IGN_COMMON_DEPENDENCIES \
$IGN_TRANSPORT_DEPENDENCIES \
$IGN_GUI_DEPENDENCIES \
libgflags-dev \
libusb-1.0-0-dev \
libglew-dev \
python3-setuptools \
python3-nose \
python3-nose-cov \
python-protobuf \
" \
&& deps=$(sed "s/\\\ //g" <<< $deps) \
&& apt-get install -y \
$deps \
&& apt-get clean'
# Remove from source builds
RUN apt-get remove -y .*sdformat.* .*ignition-common.* .*ignition-transport.* \
&& apt-get clean
# Install ignition-common from source
RUN hg clone https://bitbucket.org/osrf/sdformat && \
rm -fr sdformat/build && mkdir sdformat/build && \
cd sdformat/build && \
cmake .. -DCMAKE_INSTALL_PREFIX=/usr && \
make -j2 install
# Install ignition-common from source
RUN hg clone https://bitbucket.org/ignitionrobotics/ign-common && \
rm -fr ign-common/build && mkdir ign-common/build && \
cd ign-common/build && \
cmake .. -DCMAKE_INSTALL_PREFIX=/usr && \
make -j2 install
# Install ignition-transport from source
RUN hg clone https://bitbucket.org/ignitionrobotics/ign-transport && \
rm -fr ign-transport/build && mkdir ign-transport/build && \
cd ign-transport/build && \
cmake .. -DCMAKE_INSTALL_PREFIX=/usr && \
make -j2 install
# Install ignition-gui from source
RUN hg clone https://bitbucket.org/ignitionrobotics/ign-gui && \
rm -fr ign-gui/build && mkdir ign-gui/build && \
cd ign-gui/build && \
cmake .. -DCMAKE_INSTALL_PREFIX=/usr && \
make -j2 install
#nvidia docker
LABEL com.nvidia.volumes.needed="nvidia_driver"
ENV PATH /usr/local/nvidia/bin:${PATH}
ENV LD_LIBRARY_PATH /usr/local/nvidia/lib:/usr/local/nvidia/lib64:${LD_LIBRARY_PATH}
# stuff for gazebo
ENV LD_LIBRARY_PATH=/usr/local/lib:/usr/local/lib64:${LD_LIBRARY_PATH}
EXPOSE 11345
ARG user_id
ENV USERNAME developer
RUN useradd -U --uid ${user_id} -ms /bin/bash $USERNAME \
&& echo "$USERNAME:$USERNAME" | chpasswd \
&& adduser $USERNAME sudo \
&& echo "$USERNAME ALL=NOPASSWD: ALL" >> /etc/sudoers.d/$USERNAME
USER $USERNAME
WORKDIR /home/$USERNAME
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment