Skip to content

Commit

Permalink
Docker Support, IPOPT, Coinbrew Version Update to 3.14 (#408)
Browse files Browse the repository at this point in the history
* Update Setup with ipopt 3.14

* Add Dockerfile

* Update Dockerfile

---------

Co-authored-by: jrenaf <[email protected]>
  • Loading branch information
ologandavid and jrenaf authored Nov 10, 2023
1 parent 2bc8cfd commit 9c0e297
Show file tree
Hide file tree
Showing 2 changed files with 134 additions and 3 deletions.
131 changes: 131 additions & 0 deletions docker/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,131 @@
#############################################
# Created from template ros.dockerfile.jinja
#############################################

###########################################
# Base image
###########################################
FROM ubuntu:20.04 AS base

ENV DEBIAN_FRONTEND=noninteractive

# Install language
RUN apt-get update && apt-get install -y \
locales \
&& locale-gen en_US.UTF-8 \
&& update-locale LC_ALL=en_US.UTF-8 LANG=en_US.UTF-8 \
&& rm -rf /var/lib/apt/lists/*
ENV LANG en_US.UTF-8

# Install timezone
RUN ln -fs /usr/share/zoneinfo/UTC /etc/localtime \
&& export DEBIAN_FRONTEND=noninteractive \
&& apt-get update \
&& apt-get install -y tzdata \
&& dpkg-reconfigure --frontend noninteractive tzdata \
&& rm -rf /var/lib/apt/lists/*

###########################################
# ROS image
###########################################
FROM base AS ros

# Install ROS
RUN apt-get update && apt-get install -y \
curl \
dirmngr \
gnupg2 \
lsb-release \
sudo \
&& apt-get upgrade -y \
&& 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 | apt-key add - \
&& apt-get update && apt-get install -y \
ros-noetic-desktop-full \
&& apt-get upgrade libignition-math4 -y \
&& rm -rf /var/lib/apt/lists/*

# Setup environment
ENV LD_LIBRARY_PATH=/opt/ros/noetic/lib
ENV ROS_DISTRO=noetic
ENV ROS_ROOT=/opt/ros/noetic/share/ros
ENV ROS_PACKAGE_PATH=/opt/ros/noetic/share
ENV ROS_MASTER_URI=http://localhost:11311
ENV ROS_PYTHON_VERSION=
ENV ROS_VERSION=1
ENV PATH=/opt/ros/noetic/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
ENV ROSLISP_PACKAGE_DIRECTORIES=
ENV PYTHONPATH=/opt/ros/noetic/lib/python3.8/dist-packages
ENV PKG_CONFIG_PATH=/opt/ros/noetic/lib/pkgconfig
ENV ROS_ETC_DIR=/opt/ros/noetic/etc/ros
ENV CMAKE_PREFIX_PATH=/opt/ros/noetic
ENV DEBIAN_FRONTEND=

###########################################
# Develop image
###########################################
FROM ros AS dev

ENV DEBIAN_FRONTEND=noninteractive
# Install dev tools
RUN apt-get update && apt-get install -y \
python3-rosdep \
python3-rosinstall \
python3-rosinstall-generator \
python3-wstool \
python3-pip \
python3-pep8 \
python3-autopep8 \
pylint \
build-essential \
bash-completion \
git \
vim \
python3-catkin-tools \
&& rm -rf /var/lib/apt/lists/* \
&& rosdep init || echo "rosdep already initialized"

ARG USERNAME=ros
ARG USER_UID=1000
ARG USER_GID=$USER_UID

# Create a non-root user
RUN 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 update \
&& apt-get install -y sudo git-core bash-completion \
&& echo $USERNAME ALL=\(root\) NOPASSWD:ALL > /etc/sudoers.d/$USERNAME\
&& chmod 0440 /etc/sudoers.d/$USERNAME \
# Cleanup
&& rm -rf /var/lib/apt/lists/* \
&& echo "if [ -f /opt/ros/${ROS_DISTRO}/setup.bash ]; then source /opt/ros/${ROS_DISTRO}/setup.bash; fi" >> /home/$USERNAME/.bashrc
ENV DEBIAN_FRONTEND=

###########################################
# ADD SSH into Docker Container
###########################################


#########################################
# Set up auto-source of workspace for ros user
ARG WORKSPACE
RUN echo "if [ -f ${WORKSPACE}/devel/setup.bash ]; then source ${WORKSPACE}/devel/setup.bash; fi" >> /home/ros/.bashrc


ENV CATKIN_WS = /home/catkin_ws
ENV SDK = /home/catkin_ws/src
RUN mkdir -p $CATKIN_WS/src

RUN /bin/bash -c "source /opt/ros/${ROS_DISTRO}/setup.bash; catkin init;"
WORKDIR $SDK
RUN git clone https://github.com/robomechanics/quad-sdk.git

# ENV QUAD_SDK = /root/catkin_ws/src/quad-sdk
# WORKDIR $QUAD_SDK
# RUN git checkout devel

# ADD coinhsl /home/catkin_ws/src/quad-sdk/external/ipopt/coinhsl



6 changes: 3 additions & 3 deletions external/setup_deps.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@ then
fi
mkdir coinbrew
cd coinbrew
wget https://raw.githubusercontent.com/coin-or/coinbrew/v1.0/coinbrew
wget https://raw.githubusercontent.com/coin-or/coinbrew/v2.0/coinbrew
chmod u+x coinbrew
./coinbrew fetch Ipopt@3.13 --no-prompt
./coinbrew fetch Ipopt --no-prompt
cd ..
if [ -d "./coinhsl" ]
then
Expand All @@ -26,7 +26,7 @@ else
echo "Warning: HSL not found."
fi
cd coinbrew
./coinbrew build Ipopt --latest-release --tests none --prefix=/usr/local
./coinbrew build Ipopt --latest-release --tests none --prefix=/usr/local --no-prompt
cd ../..

# Setup and build for rbdl
Expand Down

0 comments on commit 9c0e297

Please sign in to comment.