Public | Automated Build

Last pushed: 15 days ago
Short Description
Image containing the development tools I daily use for programming
Full Description

Dockerfile for my development tools I daily use for programming, including:

  • Atom Editor
  • Atom plugins for C++ / ROS
  • GitKraken

This Dockerfile includes software either downloaded outside ppa and built from
source during the image creation. This is not the cleanest solution, but without
dedicated repositories it is the only way.

The Atom and GitKraken user's configuration could be made persistent by mounting
respectively ~/.atom and ~/.gitkraken as volumes.<br>
Note that the folder containing the atom packages will be populated with symlinks
pointing to the packages shipped with this image. If you use Atom also in your
host system, in order to keep the setups separated you can consider mounting a
different folder instead of ~/.atom.

Image Features:

  • Image size: 2.3GB
  • Out-of-the-box development setup, quickly portable on any machine
  • X11 authentication for GUIs
  • User created during runtime

In order to fully exploit the Atom packages shipped with this image, it should
contain all the toolchain and libraries to build your project. For this reason,
this image could be useful as starting point to build a reproducible development
setup. Code testing could be performed with a much simpler container (or
docker-compose system).

Atom Features:

RTags work flawlessly with CMake, just add the -DCMAKE_EXPORT_COMPILE_COMMANDS=1
flag, it will generate the compile_commands.json configuration file (reference).
RTags needs the execution of rc -J after cmake.

linter-clang and clang-complete need the .clang_complete file. Its generation
could be automated through CMake.

In order to let linter-clang recognize C++ .hpp headers instead .h, use
this ~/.atom/config.cson as default configuration:

"*":
  "core":
    customFileTypes:
       "source.cpp": [
          "h"
       ]

Build the image

 docker build -t diegoferigo/tools .

Alternative: get the image from dockerhub

docker pull diegoferigo/tools .

User configuration

This docker image allows the creation of a runtime user,
whose default UID and GID is 1000. Since this image contains tools that perform
operations on files shared with the host system, in order to avoid file ownership
and permission issues, I recommend to use the same username of your host user.
To override the default values and to start the container, execute:

USER_UID=1000
USER_GID=1000
USERNAME=$(whoami)

docker run -i -t --rm \
    -e USER_UID=$USER_UID \
    -e USER_GID=$USER_GID \
    -e USERNAME=$USERNAME \
    --name tools \
    diegoferigo/tools \
    bash

Then, spawn as many ttys as needed with

docker exec -it tools bash

X11 host access

Simple example to open Atom:

XSOCK=/tmp/.X11-unix
XAUTH=/tmp/.docker.xauth

touch $XAUTH
xauth nlist $DISPLAY | sed -e 's/^..../ffff/' | xauth -f $XAUTH nmerge -

USERNAME=$(whoami)

docker run -i -t --rm \
    -v $XSOCK:$XSOCK:rw \
    -v $XAUTH:$XAUTH:rw \
    -e XAUTHORITY=$XAUTH \
    -e "DISPLAY" \
    -e USERNAME=$USERNAME \
    --name tools \
    diegoferigo/tools \
    su -c "atom -f" $USERNAME

In order to run applications as user and not root, remember to launch them with
su -c "command_to_execute" $USERNAME.

Full example to launch a persistent Atom session

XSOCK=/tmp/.X11-unix
XAUTH=/tmp/.docker.xauth

touch $XAUTH
xauth nlist $DISPLAY | sed -e 's/^..../ffff/' | xauth -f $XAUTH nmerge -

USERNAME=$(whoami)

docker run -i -t --rm \
    -v $XSOCK:$XSOCK:rw \
    -v $XAUTH:$XAUTH:rw \
    -e XAUTHORITY=$XAUTH \
    -e "DISPLAY" \
    -e USERNAME=$USERNAME \
    -e COPY_ATOM_PACKAGES=1 \
    -v /home/diego/.atom_docker:/home/conf/.atom \
    --name tools \
    diegoferigo/tools \
    su -c "atom -f" $USERNAME

TODO

  • Explore systemd integration within container (1, 2, 3, 4)
  • rdm is started by atom, even if it is not the default option in RTags settings.
    Is it worth to include systemd in the image to gracefully handle services like this?
    (reference for rdm)
  • linter-clang should support also the compile_commands.json.
    Follow this bug report.
  • It would be great to have an atom package that handles ROS / YARP in the tree view
    as RoboWare

Resources

Docker Pull Command
Owner
diegoferigo
Source Repository

Comments (0)