Skip to content

Commit

Permalink
Overhaul dev container (#61)
Browse files Browse the repository at this point in the history
* Rework base image starting from OMPL's dockerfile

* Create build script and remove ompl user

* Use method of installing libspot that isn't deprecated

* Clean up apt at the end

* Start from ros humble base image

* Reorganize dockerfile

* Properly label and tag image

* Add options for building multiple archs

* Shorten ompl git commit hash

* Update dev image accordingly

* Rename dev dockerfile

* Clone ompl in dockerfile instead of script

* Delete all documentation from this repo

* Update dev container accordingly

* Comment out network_systems to pass CI

* Update environment variable

* Use WORKDIR for more commands

* Only symlink compile_commands.json if it exists

* Reformating dockerfiles, which includes making indents 4 spaces

* Source overlay in bashrc

* Fix location of WORKDIR /ompl

* Remove duplicate packages

* network systems updates for v2

Make sure to change the network_systems branch to v2-updates in
src/new_projects.repos

* Separate ament linters and clang-tidy

* Test network_systems v2-updates branch

* Update job name and file paths

* Simplify disabling VCS

* Move disabling vcs to ros package repo ci

Co-authored-by: hhenry01 <[email protected]>
  • Loading branch information
patrick-5546 and hhenry01 authored Jan 14, 2023
1 parent e3c0eee commit 4860380
Show file tree
Hide file tree
Showing 33 changed files with 326 additions and 698 deletions.
1 change: 1 addition & 0 deletions .clang-tidy
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ Checks: "
-clang-analyzer-optin*,
-clang-analyzer-osx*,
-google-objc*,
-readability-function-cognitive-complexity,
"

WarningsAsErrors: "*, -google-readability-todo"
2 changes: 0 additions & 2 deletions .devcontainer/.dockerignore
Original file line number Diff line number Diff line change
@@ -1,3 +1 @@
README.md
config/README.md
config/sailbot_workspace.code-workspace
36 changes: 18 additions & 18 deletions .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,26 +1,26 @@
FROM ghcr.io/ubcsailbot/sailbot_workspace/dev:cppworkspace
FROM ghcr.io/ubcsailbot/sailbot_workspace/dev:ros_humble-ompl_d8375d8-amd64

## Uncomment this section to install the packages used in the ROS 2 tutorials
# # Uncomment this section to install the apt packages used in the ROS 2 tutorials
# ENV DEBIAN_FRONTEND=noninteractive
# RUN apt-get update \
# && apt-get -y install --no-install-recommends \
# # Your package list here
# ros-eloquent-turtlesim \
# # Clean up
# && apt-get autoremove -y \
# && apt-get clean -y \
# && rm -rf /var/lib/apt/lists/*
# RUN apt-get update && \
# apt-get install -y \
# # Your package list here
# ros-humble-turtlesim \
# # Clean up
# && apt-get autoremove -y && \
# apt-get clean -y && \
# rm -rf /var/lib/apt/lists/{apt,dpkg,cache,log} /tmp/* /var/tmp/*
# ENV DEBIAN_FRONTEND=

## Uncomment this section to install additional packages
# # Uncomment this section to install additional apt packages
# ENV DEBIAN_FRONTEND=noninteractive
# RUN apt-get update \
# && apt-get -y install --no-install-recommends \
# # Your package list here
# # Clean up
# && apt-get autoremove -y \
# && apt-get clean -y \
# && rm -rf /var/lib/apt/lists/*
# RUN apt-get update && \
# apt-get install -y \
# # Your package list here
# # Clean up
# && apt-get autoremove -y && \
# apt-get clean -y && \
# rm -rf /var/lib/apt/lists/{apt,dpkg,cache,log} /tmp/* /var/tmp/*
# ENV DEBIAN_FRONTEND=

# Copy configuration files (e.g., .vimrc) from config/ to the container's home directory
Expand Down
16 changes: 0 additions & 16 deletions .devcontainer/README.md

This file was deleted.

1 change: 0 additions & 1 deletion .devcontainer/base/.dockerignore

This file was deleted.

11 changes: 0 additions & 11 deletions .devcontainer/base/Dockerfile

This file was deleted.

15 changes: 0 additions & 15 deletions .devcontainer/base/README.md

This file was deleted.

138 changes: 138 additions & 0 deletions .devcontainer/base/base.Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,138 @@
FROM ubuntu:22.04 AS ompl

ENV DEBIAN_FRONTEND=noninteractive
RUN apt-get update && \
apt-get install -y git && \
apt-get autoremove -y && \
apt-get clean -y && \
rm -rf /var/lib/apt/lists/{apt,dpkg,cache,log} /tmp/* /var/tmp/*
RUN git clone https://github.com/ompl/ompl.git
WORKDIR /ompl
RUN git reset --hard d8375d8

# From https://github.com/athackst/dockerfiles/blob/32a872348af0ad25ec4a6e6184cb803357acb6ab/ros2/humble.Dockerfile
FROM ubuntu:22.04 AS base

ENV DEBIAN_FRONTEND=noninteractive

# Install language
RUN apt-get update && apt-get install -y \
locales \
&& locale-gen en_US.UTF-8 \
&& update-locale LC_ALL=en_US.UTF-8 LANG=en_US.UTF-8 \
&& rm -rf /var/lib/apt/lists/*
ENV LANG en_US.UTF-8

# Install timezone
RUN ln -fs /usr/share/zoneinfo/UTC /etc/localtime \
&& export DEBIAN_FRONTEND=noninteractive \
&& apt-get update \
&& apt-get install -y tzdata \
&& dpkg-reconfigure --frontend noninteractive tzdata \
&& rm -rf /var/lib/apt/lists/*

# Install ROS2
RUN apt-get update && apt-get install -y \
curl \
gnupg2 \
lsb-release \
sudo \
&& curl -sSL https://raw.githubusercontent.com/ros/rosdistro/master/ros.key -o /usr/share/keyrings/ros-archive-keyring.gpg \
&& echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/ros-archive-keyring.gpg] http://packages.ros.org/ros2/ubuntu $(lsb_release -cs) main" | tee /etc/apt/sources.list.d/ros2.list > /dev/null \
&& apt-get update && apt-get install -y \
ros-humble-ros-base \
python3-argcomplete \
&& rm -rf /var/lib/apt/lists/*

ENV ROS_DISTRO=humble
ENV AMENT_PREFIX_PATH=/opt/ros/humble
ENV COLCON_PREFIX_PATH=/opt/ros/humble
ENV LD_LIBRARY_PATH=/opt/ros/humble/lib
ENV PATH=/opt/ros/humble/bin:$PATH
ENV PYTHONPATH=/opt/ros/humble/lib/python3.10/site-packages
ENV ROS_PYTHON_VERSION=3
ENV ROS_VERSION=2
ENV DEBIAN_FRONTEND=

# Based on https://github.com/ompl/ompl/blob/d8375d842a7f016d64f27a81d6f95eaa83fbe595/scripts/docker/ompl.Dockerfile
FROM base AS builder
# avoid interactive configuration dialog from tzdata, which gets pulled in
# as a dependency
ENV DEBIAN_FRONTEND=noninteractive
RUN apt-get update && \
apt-get install -y software-properties-common && \
add-apt-repository ppa:asiffer/libspot && \
apt-get update && \
apt-get install -y \
build-essential \
castxml \
cmake \
libboost-filesystem-dev \
libboost-numpy-dev \
libboost-program-options-dev \
libboost-python-dev \
libboost-serialization-dev \
libboost-system-dev \
libboost-test-dev \
libeigen3-dev \
libexpat1 \
libflann-dev \
libode-dev \
libspot-dev \
libtriangle-dev \
ninja-build \
pkg-config \
python3-dev \
python3-numpy \
python3-pip \
pypy3 \
wget && \
apt-get autoremove -y && \
apt-get clean -y && \
rm -rf /var/lib/apt/lists/{apt,dpkg,cache,log} /tmp/* /var/tmp/*
RUN pip3 install pygccxml pyplusplus
COPY --from=ompl /ompl /ompl
WORKDIR /build
RUN cmake \
-DPYTHON_EXEC=/usr/bin/python3 \
-DOMPL_REGISTRATION=OFF \
-DCMAKE_INSTALL_PREFIX=/usr \
-G Ninja \
/ompl && \
ninja update_bindings -j `nproc` && \
ninja -j `nproc` && \
ninja install

FROM base
ENV DEBIAN_FRONTEND=noninteractive
RUN apt-get update && \
apt-get install -y software-properties-common && \
add-apt-repository ppa:asiffer/libspot && \
apt-get update && \
apt-get install -y \
build-essential \
cmake \
libboost-filesystem-dev \
libboost-numpy-dev \
libboost-program-options-dev \
libboost-python-dev \
libboost-serialization-dev \
libboost-system-dev \
libeigen3-dev \
libflann-dev \
libode-dev \
libspot-dev \
libtriangle-dev \
ninja-build \
pkg-config \
python3-dev \
python3-numpy \
python3-pip \
wget && \
apt-get autoremove -y && \
apt-get clean -y && \
rm -rf /var/lib/apt/lists/{apt,dpkg,cache,log} /tmp/* /var/tmp/*

COPY --from=builder /usr /usr

LABEL org.opencontainers.image.source https://github.com/UBCSailbot/sailbot_workspace
21 changes: 21 additions & 0 deletions .devcontainer/base/build-base.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#!/bin/bash

docker build . \
--file base.Dockerfile \
--tag ghcr.io/ubcsailbot/sailbot_workspace/base:ros_humble-ompl_d8375d8-amd64 \
--build-arg ARCH=amd64/

# docker build . \
# --file base.Dockerfile \
# --tag ghcr.io/ubcsailbot/sailbot_workspace/base:ros_humble-ompl_d8375d8-arm64v8 \
# --build-arg ARCH=arm64v8/

# docker buildx build . \
# --file base.Dockerfile
# --tag ghcr.io/ubcsailbot/sailbot_workspace/base:ros_humble-ompl_d8375d8 \
# --platform linux/arm64/v8,linux/amd64 \
# # --push

# docker manifest create ghcr.io/ubcsailbot/sailbot_workspace/base:ros_humble-ompl_d8375d8-latest \
# --amend ghcr.io/ubcsailbot/sailbot_workspace/base:ros_humble-ompl_d8375d8-amd64 \
# --amend ghcr.io/ubcsailbot/sailbot_workspace/base:ros_humble-ompl_d8375d8-arm64v8
Loading

0 comments on commit 4860380

Please sign in to comment.