Skip to content
Snippets Groups Projects
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 tecnalia_robotics-public/gitlab_templates!38
parents cf824a7b 9db277da
No related branches found
No related tags found
No related merge requests found
...@@ -26,3 +26,11 @@ yamllint: ...@@ -26,3 +26,11 @@ yamllint:
script: yamllint $(find . -name '*.yml' -o -name '*.yaml') script: yamllint $(find . -name '*.yml' -o -name '*.yaml')
tags: tags:
- docker - docker
deploy_devcontainer:
script:
- tar cvfz dot_devcontainer.tar.gz -C vscode_devcontainer .devcontainer/
artifacts:
paths:
- dot_devcontainer.tar.gz
expire_in: 1 year
#-------------------------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See https://go.microsoft.com/fwlink/?linkid=2090316 for license information.
#-------------------------------------------------------------------------------------------------------------
FROM tecnalia-robotics-docker.artifact.tecnalia.com/flexbotics-base-devel:kinetic
# 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
# https://aka.ms/vscode-remote/containers/non-root-user for details.
ARG USERNAME=vscode
ARG USER_UID=1000
ARG USER_GID=$USER_UID
# 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 https://aka.ms/vscode-remote/containers/non-root-user.
&& 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
USER $USERNAME
RUN rosdep update \
&& mkdir -p /home/${USERNAME}/robot_ws/src/
COPY .devcontainer/catkin_ws_init.sh /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
ENV DEBIAN_FRONTEND=
#!/bin/bash
if [[ -z "${ROS_PACKAGE_PATH}" ]]; then
. $(find /opt/ros/ -name "setup.bash")
fi
if [[ -z "${ROS_DISTRO}" ]]; then
export ROS_DISTRO=$(basename $(find /opt/ros/* -maxdepth 0 -type d | head -1))
fi
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
fi
mkdir -p ~/.ssh/
cat << EOF >> ~/.ssh/config
Host *
StrictHostKeyChecking no
EOF
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 https://aka.ms/vscode-remote/devcontainer.json
{
"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": {
"terminal.integrated.shell.linux": "/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/catkin_ws_init.sh",
"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": [
"ms-python.python",
"ms-iot.vscode-ros"
]
}
# vscode_devcontainer
.devcontainer configuration for ROS projects
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment