Commit 05ec1274 authored by Jon Azpiazu's avatar Jon Azpiazu
Browse files

Merge branch '18-add-code-s-devcontainer-template-as-artifact' into 'master'

Resolve "Add code's devcontainer template as artifact"

Closes #18

See merge request !38
parents cf824a7b 9db277da
......@@ -26,3 +26,11 @@ yamllint:
script: yamllint $(find . -name '*.yml' -o -name '*.yaml')
- docker
- tar cvfz dot_devcontainer.tar.gz -C vscode_devcontainer .devcontainer/
- dot_devcontainer.tar.gz
expire_in: 1 year
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See for license information.
# Avoid warnings by switching to noninteractive
ENV DEBIAN_FRONTEND=noninteractive
# This Dockerfile adds a non-root 'vscode' user with sudo access. However, for Linux,
# this user's GID/UID must match your local user UID/GID to avoid permission issues
# with bind mounts. Update USER_UID / USER_GID if yours is not 1000. See
# for details.
# Configure apt and install packages
RUN apt-get update \
&& apt-get -y install --no-install-recommends apt-utils dialog 2>&1 \
# Verify git, process tools, lsb-release (common in install instructions for CLIs) installed
&& apt-get -y install git iproute2 procps lsb-release curl \
&& apt install -y git openssh-client python-catkin-tools \
# Create a non-root user to use if preferred - see
&& groupadd --gid $USER_GID $USERNAME \
&& useradd -s /bin/bash --uid $USER_UID --gid $USER_GID -m $USERNAME \
# [Optional] Add sudo support for the non-root user
&& apt-get install -y sudo \
&& echo $USERNAME ALL=\(root\) NOPASSWD:ALL > /etc/sudoers.d/$USERNAME\
&& chmod 0440 /etc/sudoers.d/$USERNAME \
&& rosdep init || true
RUN rosdep update \
&& mkdir -p /home/${USERNAME}/robot_ws/src/
COPY .devcontainer/ /tmp/
# Clean up
# && apt-get autoremove -y \
# && apt-get clean -y \
# && rm -rf /var/lib/apt/lists/*
# Switch back to dialog for any ad-hoc use of apt-get
if [[ -z "${ROS_PACKAGE_PATH}" ]]; then
. $(find /opt/ros/ -name "setup.bash")
if [[ -z "${ROS_DISTRO}" ]]; then
export ROS_DISTRO=$(basename $(find /opt/ros/* -maxdepth 0 -type d | head -1))
pkg_name=$(basename $(find /workspaces/ -maxdepth 1 -mindepth 1 -type d))
mkdir -p ~/robot_ws/src
cd ~/robot_ws/src
ln -s /workspaces/${pkg_name}
cd ..
wstool init src
if [ -f "src/${pkg_name}/.rosinstall" ]; then
wstool merge "src/${pkg_name}/.rosinstall" -t src
mkdir -p ~/.ssh/
cat << EOF >> ~/.ssh/config
Host *
StrictHostKeyChecking no
wstool update -t src
find -L src -name ci_entry_script.bash -exec bash -c 'echo Running entry script from $(basename $(dirname $1)) ; $1 ' _ {} \;
rosdep update
rosdep install --from-paths src --ignore-src --rosdistro $ROS_DISTRO -r -y
catkin init
catkin config --cmake-args -DCMAKE_CXX_FLAGS=-w --
echo "source $(find /opt/ros/ -name 'setup.bash')" >> ~/.bashrc
// For format details, see
"name": "flexbotics fat kinetic",
"context": "..",
"dockerFile": "Dockerfile",
// Use 'settings' to set *default* container specific settings.json values on container create.
// You can edit these settings after create using File > Preferences > Settings > Remote.
"settings": {
"": "/bin/bash"
// Uncomment the next line if you want to publish any ports.
// "appPort": [],
// Uncomment the next line to run commands after the container is created.
"postCreateCommand": "bash /tmp/",
"workspaceFolder": "/home/vscode/robot_ws/src/",
// Uncomment the next line to use a non-root user. On Linux, this will prevent
// new files getting created as root, but you may need to update the USER_UID
// and USER_GID in .devcontainer/Dockerfile to match your user if not 1000.
"runArgs": [ "-u", "vscode",
"-v", "${env:SSH_AUTH_SOCK}:/ssh-agent",
"-e", "SSH_AUTH_SOCK=/ssh-agent",
"-e", "DISPLAY=${env:DISPLAY}",
"-v", "/tmp/.X11-unix:/tmp/.X11-unix"
// Add the IDs of extensions you want installed when the container is created in the array below.
"extensions": [
# vscode_devcontainer
.devcontainer configuration for ROS projects
\ No newline at end of file
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment