Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Extend development containers #173

Merged
merged 1 commit into from
May 5, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,11 @@ If a related issue doesn't exist, you can [open a new issue](https://github.com/
```bash
docker/run.sh --build
```
To target an specific ROS distribution, use:
```bash
ROSDISTRO=humble docker/run.sh
```
Supported distributions include `humble` and `rolling`.

1. **[Optional]** Install pre-commit hooks. _This will probably cause you to not be able to create commits from your host machine since the hooks have dependencies that exist only in the development container._
```bash
Expand Down
4 changes: 2 additions & 2 deletions docker/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ services:
dev:
build:
context: ..
dockerfile: docker/images/humble/Dockerfile
dockerfile: docker/images/${ROSDISTRO:-humble}/Dockerfile
container_name: beluga-dev
environment:
- DISPLAY
Expand All @@ -16,7 +16,7 @@ services:
volumes:
- /tmp/.X11-unix:/tmp/.X11-unix:rw
- /tmp/.docker.xauth:/tmp/.docker.xauth
- ..:/ws/src
- ..:/ws/src/beluga
- beluga_ccache:/home/developer/.ccache
volumes:
beluga_ccache:
9 changes: 5 additions & 4 deletions docker/images/humble/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ RUN apt-get update \
ccache \
curl \
doxygen \
gdb \
git \
linux-cloud-tools-generic \
linux-tools-common \
Expand All @@ -15,6 +16,7 @@ RUN apt-get update \
python3-pip \
texlive-base \
texlive-binaries \
tmux \
&& rm -rf /var/lib/apt/lists/*

# Fix for the RViz black screen issue.
Expand Down Expand Up @@ -66,11 +68,9 @@ WORKDIR $USER_WS
RUN colcon mixin add default https://raw.githubusercontent.com/colcon/colcon-mixin-repository/master/index.yaml \
&& colcon mixin update default
COPY --chown=$USER:$GROUP docker/files/colcon_defaults.yaml /home/$USER/.colcon/defaults.yaml
RUN mkdir -p /home/$USER/.ccache
RUN mkdir -p /home/$USER/.ccache $USER_WS/src

COPY . $USER_WS/src

RUN sudo chown -R $USER:$GROUP $USER_WS
COPY --chown=$USER:$GROUP . $USER_WS/src/beluga

RUN sudo apt-get update \
&& rosdep update \
Expand All @@ -79,4 +79,5 @@ RUN sudo apt-get update \

ENV WITHIN_DEV 1

ENV SHELL /bin/bash
ENTRYPOINT ["fixuid", "-q", "/ros_entrypoint.sh", "/bin/bash"]
85 changes: 85 additions & 0 deletions docker/images/rolling/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
FROM ros:rolling-ros-base-jammy

ENV DEBIAN_FRONTEND noninteractive

RUN apt-get update \
&& apt-get install --no-install-recommends -y \
ccache \
curl \
doxygen \
gdb \
git \
linux-cloud-tools-generic \
linux-tools-common \
linux-tools-generic \
perl \
python3-pip \
texlive-base \
texlive-binaries \
tmux \
&& rm -rf /var/lib/apt/lists/*

# Fix for the RViz black screen issue.
# TODO(nahuel): Remove this when the Mesa version available
# in Ubuntu 22.04 is 22.3.5 or greater.
# See https://github.com/ekumenlabs/beluga/issues/123
RUN apt-get update \
&& apt-get install --no-install-recommends -y \
software-properties-common \
&& add-apt-repository -y ppa:kisak/kisak-mesa \
&& apt-get install --no-install-recommends -y \
libegl-mesa0 libglx-mesa0 \
&& rm -rf /var/lib/apt/lists/*

RUN pip install \
evo==1.21.0 \
pre-commit==2.20.0 \
# Note: Installing timemory takes a long time.
timemory==3.3.0rc4

# Check if perf is working, if not replace it with the perf version available
RUN perf help || ( \
mv /usr/bin/perf /usr/bin/perf.bkp && \
ln -s $(ls -d /usr/lib/linux-tools/* | tail -n1)/perf /usr/bin/perf)

ARG USER=developer
ARG GROUP=ekumen

RUN addgroup --gid 1000 $GROUP \
&& adduser --uid 1000 --ingroup $GROUP --home /home/$USER --shell /bin/sh --disabled-password --gecos "" $USER \
&& adduser $USER sudo \
&& echo "$USER ALL=NOPASSWD: ALL" >> /etc/sudoers.d/$USER

COPY docker/files/fixuid_config.yml /etc/fixuid/config.yml
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 - \
&& chmod 4755 /usr/local/bin/fixuid \
&& cd /etc/fixuid \
&& sed -i "s/_USER_/$USER/" config.yml \
&& sed -i "s/_GROUP_/$GROUP/" config.yml

RUN cd /opt && git clone https://github.com/brendangregg/FlameGraph

USER $USER:$GROUP

ENV USER_WS /ws

WORKDIR $USER_WS

RUN colcon mixin add default https://raw.githubusercontent.com/colcon/colcon-mixin-repository/master/index.yaml \
&& colcon mixin update default
COPY --chown=$USER:$GROUP docker/files/colcon_defaults.yaml /home/$USER/.colcon/defaults.yaml
RUN mkdir -p /home/$USER/.ccache $USER_WS/src

COPY --chown=$USER:$GROUP . $USER_WS/src/beluga

RUN git -C $USER_WS/src clone https://github.com/ros-planning/navigation2.git
nahueespinosa marked this conversation as resolved.
Show resolved Hide resolved

RUN sudo apt-get update && sudo apt-get -y dist-upgrade \
&& rosdep update \
&& rosdep install -i --from-path src -y --skip-keys 'slam_toolbox' \
&& sudo rm -rf /var/lib/apt/lists/*

ENV WITHIN_DEV 1

ENV SHELL /bin/bash
ENTRYPOINT ["fixuid", "-q", "/ros_entrypoint.sh", "/bin/bash"]