forked from space-ros/demos
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
added functioning Dockerfile, build working
- Loading branch information
1 parent
1375d82
commit 6555cea
Showing
6 changed files
with
65 additions
and
126 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,105 +1,37 @@ | ||
# Copyright 2021 Open Source Robotics Foundation, Inc. | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
# | ||
# A Docker configuration script to build the Space ROS image. | ||
# | ||
# The script provides the following build arguments: | ||
# | ||
# VCS_REF - The git revision of the Space ROS source code (no default value). | ||
# VERSION - The version of Space ROS (default: "preview") | ||
|
||
FROM osrf/space-ros:latest | ||
|
||
# Define arguments used in the metadata definition | ||
ARG VCS_REF | ||
ARG VERSION="preview" | ||
|
||
# Specify the docker image metadata | ||
LABEL org.label-schema.schema-version="1.0" | ||
LABEL org.label-schema.name="Curiosity Rover" | ||
LABEL org.label-schema.description="Curiosity rover demo on the Space ROS platform" | ||
LABEL org.label-schema.vendor="Open Robotics" | ||
LABEL org.label-schema.version=${VERSION} | ||
LABEL org.label-schema.url="https://github.com/space-ros" | ||
LABEL org.label-schema.vcs-url="https://github.com/space-ros/docker" | ||
LABEL org.label-schema.vcs-ref=${VCS_REF} | ||
|
||
# Define a few key variables | ||
ENV DEMO_DIR=${HOME_DIR}/demos_ws | ||
# ENV IGNITION_VERSION fortress | ||
ENV GZ_VERSION harmonic | ||
|
||
# Disable prompting during package installation | ||
ARG DEBIAN_FRONTEND=noninteractive | ||
|
||
# Get rosinstall_generator | ||
# Using Docker BuildKit cache mounts for /var/cache/apt and /var/lib/apt ensures that | ||
# the cache won't make it into the built image but will be maintained between steps. | ||
RUN --mount=type=cache,target=/var/cache/apt,sharing=locked \ | ||
--mount=type=cache,target=/var/lib/apt,sharing=locked \ | ||
sudo apt-get update -y && sudo apt-get install -y python3-rosinstall-generator | ||
|
||
# TODO(anyone): remove demo-pkgs.txt, no packages left after exclusions | ||
# Generate repos file for demo dependencies, excluding packages from Space ROS core. | ||
# COPY --chown=${USERNAME}:${USERNAME} demo-pkgs.txt /tmp/ | ||
# COPY --chown=${USERNAME}:${USERNAME} excluded-pkgs.txt /tmp/ | ||
# RUN rosinstall_generator \ | ||
# --rosdistro ${ROSDISTRO} \ | ||
# --deps \ | ||
# --exclude-path ${SPACEROS_DIR}/src \ | ||
# --exclude-path ${MOVEIT2_DIR}/src \ | ||
# --exclude $(cat /tmp/excluded-pkgs.txt) -- \ | ||
# -- $(cat /tmp/demo-pkgs.txt) \ | ||
# > /tmp/demo_generated_pkgs.repos | ||
|
||
RUN mkdir -p ${DEMO_DIR}/src | ||
WORKDIR ${DEMO_DIR} | ||
|
||
|
||
# Install libmongoc for development | ||
RUN --mount=type=cache,target=/var/cache/apt,sharing=locked \ | ||
--mount=type=cache,target=/var/lib/apt,sharing=locked \ | ||
sudo apt-get install libmongoc-dev -y | ||
|
||
# Compile mongo cxx driver https://mongocxx.org/mongocxx-v3/installation/linux/ | ||
# RUN --mount=type=cache,target=/var/cache/apt,sharing=locked \ | ||
# --mount=type=cache,target=/var/lib/apt,sharing=locked \ | ||
# sudo apt-get install libssl-dev build-essential devscripts debian-keyring fakeroot debhelper cmake libboost-dev libsasl2-dev libicu-dev libzstd-dev doxygen -y | ||
# RUN wget https://github.com/mongodb/mongo-cxx-driver/releases/download/r3.6.7/mongo-cxx-driver-r3.6.7.tar.gz | ||
# RUN tar -xzf mongo-cxx-driver-r3.6.7.tar.gz | ||
# RUN cd mongo-cxx-driver-r3.6.7/build && cmake .. -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=/usr/local && sudo cmake --build . --target EP_mnmlstc_core && cmake --build . && sudo cmake --build . --target install | ||
|
||
# Get the source for the dependencies | ||
# RUN vcs import src < /tmp/demo_generated_pkgs.repos | ||
COPY --chown=${USERNAME}:${USERNAME} demo_manual_pkgs.repos /tmp/ | ||
RUN vcs import src < /tmp/demo_manual_pkgs.repos && /bin/bash -c 'source "${SPACEROS_DIR}/install/setup.bash"' | ||
|
||
RUN --mount=type=cache,target=/var/cache/apt,sharing=locked \ | ||
--mount=type=cache,target=/var/lib/apt,sharing=locked \ | ||
sudo apt-get update -y \ | ||
&& /bin/bash -c 'source "${SPACEROS_DIR}/install/setup.bash"' \ | ||
# && /bin/bash -c 'source "${MOVEIT2_DIR}/install/setup.bash"' \ | ||
&& rosdep install --from-paths src --ignore-src -r -y --rosdistro ${ROS_DISTRO} | ||
|
||
# Build the demo | ||
RUN /bin/bash -c 'source ${SPACEROS_DIR}/install/setup.bash \ | ||
&& colcon build --cmake-args -DCMAKE_BUILD_TYPE=Release' | ||
|
||
# Add the user to the render group so that the user can access /dev/dri/renderD128 | ||
RUN sudo usermod -aG render $USERNAME | ||
|
||
# Setup the entrypoint | ||
COPY ./entrypoint.sh / | ||
ENTRYPOINT ["/entrypoint.sh"] | ||
CMD ["bash"] | ||
# Install Gazebo Harmonic: | ||
# https://gazebosim.org/docs/harmonic/install_ubuntu/#binary-installation-on-ubuntu | ||
RUN sudo apt-get update | ||
RUN sudo apt-get install lsb-release gnupg | ||
RUN sudo curl https://packages.osrfoundation.org/gazebo.gpg --output /usr/share/keyrings/pkgs-osrf-archive-keyring.gpg | ||
RUN echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/pkgs-osrf-archive-keyring.gpg] http://packages.osrfoundation.org/gazebo/ubuntu-stable $(lsb_release -cs) main" | sudo tee /etc/apt/sources.list.d/gazebo-stable.list > /dev/null | ||
RUN sudo apt-get update | ||
|
||
# Install required packages | ||
RUN sudo apt-get update \ | ||
&& sudo apt-get install -y --no-install-recommends \ | ||
bash \ | ||
bash-completion \ | ||
build-essential \ | ||
cmake \ | ||
git \ | ||
python-is-python3 \ | ||
python3-pip \ | ||
gz-harmonic \ | ||
&& sudo apt-get autoremove -y | ||
|
||
# Replace old entrypoint with an entrypoint that extends upon it | ||
# This is necessary as Gazebo Harmonic has been installed as well as some new ROS packages. | ||
# RUN sudo mv /ros_entrypoint.sh /old_entrypoint.sh | ||
# COPY entrypoint.sh /ros_entrypoint.sh | ||
# RUN sudo chmod +x /ros_entrypoint.sh | ||
|
||
# Set up workspace | ||
RUN mkdir -p /home/spaceros-user/heightmap_demo | ||
WORKDIR /home/spaceros-user/heightmap_demo | ||
# Copy over the files so that we can pre-build the package with colcon | ||
COPY heightmap_demo /home/spaceros-user/heightmap_demo | ||
# Source ROS environment and build the package | ||
# RUN . /opt/ros/humble/setup.sh && . ${SPACEROS_DIR}/install/setup.sh && colcon build |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
#!/usr/bin/env bash | ||
|
||
ORG=openrobotics | ||
IMAGE=space_robots_demo | ||
IMAGE=heightmap_demo | ||
TAG=latest | ||
|
||
VCS_REF="" | ||
|
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
#!/usr/bin/env bash | ||
|
||
# Runs a docker container with the image created by build.bash | ||
# Requires: | ||
# docker | ||
# an X server | ||
|
||
IMG_NAME=openrobotics/heightmap_demo | ||
|
||
# Replace `/` with `_` to comply with docker container naming | ||
# And append `_runtime` | ||
CONTAINER_NAME="$(tr '/' '_' <<< "$IMG_NAME")2" | ||
|
||
# Start the container | ||
# docker run --rm -it --name $CONTAINER_NAME --network host \ | ||
# -e DISPLAY -e TERM -e QT_X11_NO_MITSHM=1 $IMG_NAME | ||
|
||
docker run -it --name $CONTAINER_NAME --network host \ | ||
-e DISPLAY -e TERM -e QT_X11_NO_MITSHM=1 $IMG_NAME | ||
|