diff --git a/ce/Dockerfile b/ce/Dockerfile index 600a1d4..fd61049 100644 --- a/ce/Dockerfile +++ b/ce/Dockerfile @@ -1,6 +1,6 @@ # This Dockerfile is used to build an rviz image based on Ubuntu ARG DOCKER_REGISTRY="pubregistry.aws.cloud.mov.ai" -FROM ${DOCKER_REGISTRY}/ce/movai-base-focal:v1.4.11 +FROM ${DOCKER_REGISTRY}/ce/movai-base-focal:v2.4.0 LABEL description="MOV.AI Graphical Tools" LABEL maintainer="devops@mov.ai" diff --git a/files/bin/rviz.sh b/files/bin/rviz.sh index 4cf5fee..b2e61cb 100755 --- a/files/bin/rviz.sh +++ b/files/bin/rviz.sh @@ -2,6 +2,4 @@ # File: rviz.sh set -e -source "/opt/ros/${ROS_DISTRO}/setup.bash" - -ROS_MASTER_URI="http://${ROS_MASTER}:${ROS_MASTER_PORT}" "/opt/ros/${ROS_DISTRO}/bin/rviz" +ROS_MASTER_URI="http://${ROS_MASTER}:${ROS_MASTER_PORT}" "/usr/bin/rviz" diff --git a/files/common/install/ros-tools.sh b/files/common/install/ros-tools.sh index 27fdd32..fe6549d 100644 --- a/files/common/install/ros-tools.sh +++ b/files/common/install/ros-tools.sh @@ -2,7 +2,12 @@ ### every exit != 0 fails the script set -e -echo "Install IceWM UI components" +echo "Setup ROS-Tools repo" +sh -c 'echo "deb http://packages.ros.org/ros/ubuntu $(lsb_release -sc) main" > /etc/apt/sources.list.d/ros-latest.list' +curl -s https://raw.githubusercontent.com/ros/rosdistro/master/ros.asc | sudo apt-key add - + +echo "Install ROS-Tools components" apt-get update -apt-get install -y terminator +apt-get install --no-install-recommends -y rviz \ + "ros-$ROS_DISTRO-rqt" "ros-$ROS_DISTRO-rqt-common-plugins" apt-get clean -y diff --git a/files/deploy.sh b/files/deploy.sh deleted file mode 100755 index 62ddde3..0000000 --- a/files/deploy.sh +++ /dev/null @@ -1,26 +0,0 @@ -#!/bin/bash -# -# Copyright 2021 MOV.AI (devops@mov.ai) -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# File: deploy.sh -set -e - -if [ -f ${APP_PATH}/requirements.txt ]; then - printf "Installing python dependencies...\n" - pushd ${APP_PATH} > /dev/null - python3 -m pip install pip --user --upgrade - python3 -m pip install --user --no-cache-dir -r requirements.txt - popd > /dev/null -fi diff --git a/files/docker-entrypoint.sh b/files/docker-entrypoint.sh index ba2240e..df6c693 100755 --- a/files/docker-entrypoint.sh +++ b/files/docker-entrypoint.sh @@ -22,42 +22,5 @@ ln -sf /proc/1/fd/1 ${APP_LOGS}/stdout [ -f ${MOVAI_HOME}/.welcome ] && cat ${MOVAI_HOME}/.welcome -# Code from https://stackoverflow.com/questions/4023830/how-to-compare-two-strings-in-dot-separated-version-format-in-bash - -function compare_version() { - - if [ "${1}" == "${2}" ]; then - return 0 - fi - - local IFS=. - local i ver1=(${1}) ver2=(${2}) - # fill empty fields in ver1 with zeros - for ((i = ${#ver1[@]}; i < ${#ver2[@]}; i++)); do - ver1[i]=0 - done - - for ((i = 0; i < ${#ver1[@]}; i++)); do - if [[ -z ${ver2[i]} ]]; then - # fill empty fields in ver2 with zeros - ver2[i]=0 - fi - if ((10#${ver1[i]} > 10#${ver2[i]})); then - return 1 - fi - if ((10#${ver1[i]} < 10#${ver2[i]})); then - return 2 - fi - done - - return 0 -} - -# If we have updates on our update folder we do the update -if [ $(ls ${APP_UPDATES}/movai-*_latest_*.deb 2>/dev/null) ]; then - # Run the update procedure and exit if everything goes well - update.sh && exit -fi - # Run command exec /usr/local/bin/movai-entrypoint.sh ${@} diff --git a/files/home/.bashrc b/files/home/.bashrc index 104d31a..5727cbf 100644 --- a/files/home/.bashrc +++ b/files/home/.bashrc @@ -113,6 +113,8 @@ if [ "$TERM" != "linux" ] && [ -f "/usr/local/bin/powerline-go" ]; then PROMPT_COMMAND="_update_ps1; $PROMPT_COMMAND" fi -source "/opt/ros/$ROS_DISTRO/setup.bash" +if [ -f /opt/ros/${ROS_DISTRO}/setup.bash ]; then + source "/opt/ros/$ROS_DISTRO/setup.bash" +fi export ROS_MASTER_URI="http://${ROS_MASTER}:${ROS_MASTER_PORT}" \ No newline at end of file diff --git a/files/install-packages.sh b/files/install-packages.sh deleted file mode 100755 index 74e7036..0000000 --- a/files/install-packages.sh +++ /dev/null @@ -1,56 +0,0 @@ -#!/bin/bash -# -# Copyright 2021 MOV.AI (devops@mov.ai) -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# File: install-packages.sh -set -eo pipefail - -# Install apt dependencies - -PACKAGE_FILE=/tmp/packages.apt - -# If there is a package definition file, install packages then clean up -if [ -f ${PACKAGE_FILE} ]; then - printf "Installing APT packages from list: %s ...\n" "$(basename ${PACKAGE_FILE})" - packages_list=$(sed -e 's/#.*$//' -e '/^$/d' ${PACKAGE_FILE}| sed ':a;N;$!ba;s/\n/ /g') - - printf "APT Packages list: %s\n" "${packages_list}" - apt-get update - DEBIAN_FRONTEND=noninteractive apt-get -y --no-install-recommends install ${packages_list} - apt-get clean -y - rm --preserve-root ${PACKAGE_FILE} - rm -rf /var/cache/apt/* - rm -rf /var/lib/apt/lists/* -fi - -# Install custom dependencies and commands - -PIP_REQUIREMENTS=/tmp/requirements.txt - -# If there is a python requirements script, install packages then clean up -[ -f ${PIP_REQUIREMENTS} ] && { - python3 -m pip install --upgrade pip; - python3 -m pip install --upgrade -r ${PIP_REQUIREMENTS}; - rm --preserve-root ${PIP_REQUIREMENTS}; -} - -PACKAGES_SCRIPT=/tmp/packages.bash - -# If there is a package script, install packages then clean up -[ -f ${PACKAGES_SCRIPT} ] && { chmod 700 ${PACKAGES_SCRIPT}; ${PACKAGES_SCRIPT}; rm --preserve-root ${PACKAGES_SCRIPT}; } - - -printf "Cleaning up ...\n" -rm -rf /tmp/* diff --git a/files/ubuntu/install/icewm_ui.sh b/files/ubuntu/install/icewm_ui.sh index 527ffcc..4cd406e 100644 --- a/files/ubuntu/install/icewm_ui.sh +++ b/files/ubuntu/install/icewm_ui.sh @@ -3,7 +3,7 @@ set -e echo "Install IceWM UI components" -apt-get update -apt-get install -y supervisor icewm xterm xfonts-base xauth xinit +apt-get update +apt-get install --no-install-recommends -y supervisor icewm xterm xfonts-base xauth xinit apt-get purge -y pm-utils xscreensaver* apt-get clean -y \ No newline at end of file diff --git a/files/ubuntu/install/install_custom_fonts.sh b/files/ubuntu/install/install_custom_fonts.sh index 14fdb62..4c1b9be 100644 --- a/files/ubuntu/install/install_custom_fonts.sh +++ b/files/ubuntu/install/install_custom_fonts.sh @@ -3,4 +3,4 @@ set -e echo "Installing ttf-wqy-zenhei" -apt-get install -y ttf-wqy-zenhei +apt-get install --no-install-recommends -y ttf-wqy-zenhei diff --git a/files/ubuntu/install/tools.sh b/files/ubuntu/install/tools.sh index 6881096..1fcd0fe 100644 --- a/files/ubuntu/install/tools.sh +++ b/files/ubuntu/install/tools.sh @@ -3,10 +3,12 @@ set -e echo "Install some common tools for further installation" -apt-get update -apt-get install -y vim wget net-tools locales bzip2 \ +apt-get update +apt-get install --no-install-recommends -y terminator vim wget net-tools locales bzip2 \ python-numpy #used for websockify/novnc apt-get clean -y -echo "generate locales für en_US.UTF-8" -locale-gen en_US.UTF-8 \ No newline at end of file +echo "generate locales for $LANG" +locale-gen "$LANG" +dpkg-reconfigure locales + diff --git a/files/update.sh b/files/update.sh deleted file mode 100755 index 9d52b3f..0000000 --- a/files/update.sh +++ /dev/null @@ -1,94 +0,0 @@ -#!/bin/bash -# -# Copyright 2021 MOV.AI (devops@mov.ai) -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# File: update.sh -set -e - -UPDATE_FILE=$(ls ${APP_UPDATES}/movai-*_latest_*.deb) - -# If there is no version file we create one -[ ! -f ${MOVAI_HOME}/version ] && touch ${MOVAI_HOME}/version - -# Get package version -VERSION_UPDATE=$(dpkg-deb -f ${UPDATE_FILE} Version) -VERSION_CURRENT=$(<${MOVAI_HOME}/version) -RETVAL=1 - -compare_version "${VERSION_CURRENT}" "${VERSION_UPDATE}" - -# if the packaged version is greater then the one we have we -# do the installation -if [ ${?} -eq 2 ]; then - - printf "Starting updating to version: %s\n" "${VERSION_UPDATE}" - - # Create working directory - WORKDIR=$(mktemp -d) - pushd ${WORKDIR} >/dev/null - - # Unpack the firmware deb packages - printf "Unpackaging firmware...\n" - dpkg-deb -x ${UPDATE_FILE} ./ - - # Check if we need pre installation actions - if [ -f .${APP_PATH}/pre-installation.bash ]; then - printf "Running pre installation actions!\n" - pushd .${APP_PATH} >/dev/null - bash pre-installation.bash - rm pre-installation.bash - popd >/dev/null - fi - - # clean old application - printf "Cleaning old firmware..\n" - rm -rf ${APP_PATH}/* - - # move new update - printf "Installing new firmware...\n" - mv .${APP_PATH}/* ${APP_PATH} - - # update pip requeriments - if [ -f ${APP_PATH}/requirements.txt ]; then - printf "Installing python dependencies...\n" - pushd ${APP_PATH} >/dev/null - python3 -m pip install pip --user --upgrade - python3 -m pip install --user --no-cache-dir -r requirements.txt - popd >/dev/null - fi - - # Check if we need post installation actions - if [ -f ${APP_PATH}/post-installation.bash ]; then - printf "Running post installation actions!\n" - pushd ${APP_PATH} >/dev/null - bash post-installation.bash - rm post-installation.bash - popd >/dev/null - fi - - popd >/dev/null - - # store current version - echo ${VERSION_UPDATE} > ${MOVAI_HOME}/version - - printf "Cleaning up resources...\n" - rm -rf ${WORKDIR} - - # If update go well we return a 0 code - RETVAL=0 -fi - -rm ${UPDATE_FILE} -exit ${RETVAL} \ No newline at end of file diff --git a/melodic/Dockerfile b/melodic/Dockerfile index 0ada8ac..14c55ac 100644 --- a/melodic/Dockerfile +++ b/melodic/Dockerfile @@ -1,6 +1,6 @@ # This Dockerfile is used to build an headless vnc image based on Ubuntu - -FROM osrf/ros:melodic-desktop-full +ARG DOCKER_REGISTRY="registry.cloud.mov.ai" +FROM ${DOCKER_REGISTRY}/devops/movai-base-bionic:v2.4.0 LABEL description="MOV.AI Graphical Tools" LABEL maintainer="devops@mov.ai" @@ -31,7 +31,8 @@ ENV DISPLAY=:1 \ VNC_VIEW_ONLY=false \ ROS_VERSION=${ROS_VERSION} \ ROS_MASTER=${ROS_MASTER} \ - ROS_MASTER_PORT=${ROS_MASTER_PORT} + ROS_MASTER_PORT=${ROS_MASTER_PORT} \ + ROS_DISTRO=melodic ### Environment config ENV HOME=${USER_HOME} \ @@ -44,9 +45,6 @@ ENV HOME=${USER_HOME} \ ### ROS Config ENV ROS_MASTER_URI="http://${ROS_MASTER}:${ROS_MASTER_PORT}" -RUN adduser --uid ${USER_ID} --home ${HOME} --disabled-password --gecos '' ${USER_NAME} && \ - apt-key adv --keyserver 'hkp://keyserver.ubuntu.com:80' --recv-key "${ROS_GPG_KEY}" - WORKDIR ${HOME} ### Add all install scripts for further steps diff --git a/noetic/Dockerfile b/noetic/Dockerfile index 9235ab5..8230685 100644 --- a/noetic/Dockerfile +++ b/noetic/Dockerfile @@ -1,6 +1,6 @@ # This Dockerfile is used to build an headless vnc image based on Ubuntu - -FROM osrf/ros:noetic-desktop-full +ARG DOCKER_REGISTRY="registry.cloud.mov.ai" +FROM ${DOCKER_REGISTRY}/devops/movai-base-focal:v2.4.0 LABEL description="MOV.AI Graphical Tools" LABEL maintainer="devops@mov.ai" @@ -31,7 +31,8 @@ ENV DISPLAY=:1 \ VNC_VIEW_ONLY=false \ ROS_VERSION=${ROS_VERSION} \ ROS_MASTER=${ROS_MASTER} \ - ROS_MASTER_PORT=${ROS_MASTER_PORT} + ROS_MASTER_PORT=${ROS_MASTER_PORT} \ + ROS_DISTRO=noetic ### Environment config ENV HOME=${USER_HOME} \ @@ -44,9 +45,6 @@ ENV HOME=${USER_HOME} \ ### ROS Config ENV ROS_MASTER_URI="http://${ROS_MASTER}:${ROS_MASTER_PORT}" -RUN adduser --uid ${USER_ID} --home ${HOME} --disabled-password --gecos '' ${USER_NAME} && \ - apt-key adv --keyserver 'hkp://keyserver.ubuntu.com:80' --recv-key "${ROS_GPG_KEY}" - WORKDIR ${HOME} ### Add all install scripts for further steps