Skip to content

Commit

Permalink
Revert "build: remove deprecated Dockerfiles and scripts and update i…
Browse files Browse the repository at this point in the history
…nstallation instructions (#176)"

This reverts commit 08657ae.
  • Loading branch information
domire8 committed Apr 17, 2024
1 parent 099c8e1 commit fb7c9e9
Show file tree
Hide file tree
Showing 30 changed files with 1,246 additions and 230 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ jobs:
exit 1
fi
DEMO_CMAKE="./demos/CMakeLists.txt"
if [ $(echo $(grep "find_package(control_libraries" "${DEMO_CMAKE}") | tr -d -c 0-9) -ne "${VERSION}" ]; then
if [ $(echo $(grep "project(clproto VERSION" "${DEMO_CMAKE}") | tr -d -c 0-9) -ne "${VERSION}" ]; then
echo "::error file="${DEMO_CMAKE}",title=Check failed::Version in "${DEMO_CMAKE}" does not correspond to VERSION. ${MESSAGE}"
exit 1
fi
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/generate-docs.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: Generate and Deploy Documentation
on:
push:
push:
branches:
- main

Expand Down
1 change: 0 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ Release Versions:

## Upcoming changes (in development)

- build: remove deprecated Dockerfiles and scripts and update installation instructions (#176)
- refactor: optimize copy and swap constructor for robot model (#174)
- fix: refactor cmake project to deal with robot model dependencies (#178)
- feat: integrate minimum distance calculation feature into robot model(#167)
Expand Down
6 changes: 1 addition & 5 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,12 +1,8 @@
cmake_minimum_required(VERSION 3.15)
project(all_control_libraries)

option(BUILD_PROTOCOL "Build and install the protocol" ON)

add_subdirectory(source)
if(BUILD_PROTOCOL)
add_subdirectory(protocol/clproto_cpp)
endif()
add_subdirectory(protocol/clproto_cpp)

if(BUILD_TESTING)
# reexport the test target defined in the subdirectories
Expand Down
4 changes: 2 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ RUN apt-get update && apt-get install -y \
g++ \
git \
libgtest-dev \
libeigen3-dev \
python3-pip \
ssh \
sudo \
Expand Down Expand Up @@ -82,7 +83,7 @@ ARG TARGETPLATFORM
ARG CACHEID
COPY dependencies/base_dependencies.cmake CMakeLists.txt
RUN --mount=type=cache,target=/build,id=cmake-base-deps-${TARGETPLATFORM}-${CACHEID},uid=1000 \
cmake -B build -DBUILD_TESTING=OFF -DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE} && cmake --build build && cmake --install build --prefix /tmp/deps
cmake -B build -DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE} && cmake --build build && cmake --install build --prefix /tmp/deps

FROM base as pinocchio-dependencies
COPY --from=apt-dependencies /tmp/apt /
Expand Down Expand Up @@ -125,7 +126,6 @@ FROM base as dependencies
ARG TARGETPLATFORM
ARG CACHEID
# Needed to build `osqp-eigen`
COPY --from=apt-dependencies /tmp/apt /
COPY --from=base-dependencies /tmp/deps /usr
COPY dependencies/dependencies.cmake CMakeLists.txt
RUN --mount=type=cache,target=/build,id=cmake-deps-${TARGETPLATFORM}-${CACHEID},uid=1000 \
Expand Down
160 changes: 160 additions & 0 deletions Dockerfile.base
Original file line number Diff line number Diff line change
@@ -0,0 +1,160 @@
ARG BASE_TAG=22.04
FROM ubuntu:${BASE_TAG} as core-build-dependencies
ENV DEBIAN_FRONTEND=noninteractive

# install core compilation and access dependencies for building the libraries
RUN apt-get update && apt-get install -y \
autoconf \
automake \
build-essential \
cmake \
curl \
g++ \
gcc \
git \
gnupg2 \
libtool \
lsb-release \
make \
pkg-config \
wget \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*


FROM core-build-dependencies as google-dependencies

RUN apt-get update && apt-get install -y \
libgtest-dev \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*

# install gtest
WORKDIR /tmp
RUN mkdir gtest_build && cd gtest_build && cmake /usr/src/gtest && make -j \
&& cp lib/* /usr/local/lib || cp *.a /usr/local/lib

RUN rm -rf /tmp/* && ldconfig


FROM core-build-dependencies as robot-model-dependencies

RUN apt-get update && apt-get install -y \
libboost-all-dev \
liburdfdom-dev \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*

WORKDIR /tmp
ARG EIGEN_TAG=3.4.0
RUN wget -c https://gitlab.com/libeigen/eigen/-/archive/${EIGEN_TAG}/eigen-${EIGEN_TAG}.tar.gz -O - | tar -xz \
&& cd eigen-${EIGEN_TAG} && mkdir build && cd build && env CXXFLAGS=-DEIGEN_MPL2_ONLY cmake .. && make install \
&& cd ../.. && rm -r eigen-${EIGEN_TAG} || exit 1

ARG OSQP_TAG=0.6.2
RUN git clone --depth 1 -b v${OSQP_TAG} --recursive https://github.com/oxfordcontrol/osqp \
&& cd osqp && mkdir build && cd build && cmake -G "Unix Makefiles" .. && cmake --build . --target install \
&& cd ../.. && rm -r osqp || exit 1

ARG OSQP_EIGEN_TAG=0.6.4
RUN git clone --depth 1 -b v${OSQP_EIGEN_TAG} https://github.com/robotology/osqp-eigen.git \
&& cd osqp-eigen && mkdir build && cd build && cmake .. && make -j && make install \
&& cd ../.. && rm -r osqp-eigen || exit 1

ARG PINOCCHIO_TAG=2.6.9
RUN git clone --depth 1 -b v${PINOCCHIO_TAG} --recursive https://github.com/stack-of-tasks/pinocchio \
&& cd pinocchio && mkdir build && cd build \
&& cmake .. -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=/usr/local -DBUILD_PYTHON_INTERFACE=OFF \
-DBUILD_TESTING=OFF && make -j $(nproc --ignore=1) && make install && cd ../.. && rm -r pinocchio || exit 1

RUN ldconfig


FROM robot-model-dependencies as development-dependencies
RUN apt-get update && apt-get install -y \
clang \
gdb \
python3 \
python3-dev \
python3-pip \
tar \
unzip \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*

# install python requirements
RUN pip3 install pytest numpy setuptools pybind11

# install google dependencies
COPY --from=google-dependencies /usr/include/gtest /usr/include/gtest
COPY --from=google-dependencies /usr/local/lib/libgtest* /usr/local/lib/


FROM development-dependencies as proto-dependencies-20.04
COPY --from=ghcr.io/aica-technology/control-libraries/proto-dependencies:20.04 /usr/local/include/google /usr/local/include/google
COPY --from=ghcr.io/aica-technology/control-libraries/proto-dependencies:20.04 /usr/local/lib/libproto* /usr/local/lib/
COPY --from=ghcr.io/aica-technology/control-libraries/proto-dependencies:20.04 /usr/local/bin/protoc /usr/local/bin
RUN ldconfig


FROM development-dependencies as proto-dependencies-22.04
COPY --from=ghcr.io/aica-technology/control-libraries/proto-dependencies:22.04 /usr/local/include/google /usr/local/include/google
COPY --from=ghcr.io/aica-technology/control-libraries/proto-dependencies:22.04 /usr/local/lib/libproto* /usr/local/lib/
COPY --from=ghcr.io/aica-technology/control-libraries/proto-dependencies:22.04 /usr/local/bin/protoc /usr/local/bin
RUN ldconfig


FROM development-dependencies as proto-dependencies-latest
COPY --from=ghcr.io/aica-technology/control-libraries/proto-dependencies:latest /usr/local/include/google /usr/local/include/google
COPY --from=ghcr.io/aica-technology/control-libraries/proto-dependencies:latest /usr/local/lib/libproto* /usr/local/lib/
COPY --from=ghcr.io/aica-technology/control-libraries/proto-dependencies:latest /usr/local/bin/protoc /usr/local/bin
RUN ldconfig


FROM proto-dependencies-${BASE_TAG} as license-information
RUN mkdir -p /usr/share/doc/control-libraries
COPY ./licenses /usr/share/doc/control-libraries/licenses


FROM license-information as ssh-configuration

RUN apt-get update && apt-get install -y \
sudo \
libssl-dev \
ssh \
iputils-ping \
rsync \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*

# Configure sshd server settings
RUN ( \
echo 'LogLevel DEBUG2'; \
echo 'PubkeyAuthentication yes'; \
echo 'Subsystem sftp /usr/lib/openssh/sftp-server'; \
) > /etc/ssh/sshd_config_development \
&& mkdir /run/sshd

ENV USER developer
ENV HOME /home/${USER}

# create and configure a new user
ARG UID=1000
ARG GID=1000
RUN addgroup --gid ${GID} ${USER}
RUN adduser --gecos "Remote User" --uid ${UID} --gid ${GID} ${USER} && yes | passwd ${USER}
RUN usermod -a -G dialout ${USER}
RUN echo "${USER} ALL=(ALL) NOPASSWD: ALL" > /etc/sudoers.d/99_aptget
RUN chmod 0440 /etc/sudoers.d/99_aptget && chown root:root /etc/sudoers.d/99_aptget

# Configure sshd entrypoint to authorise the new user for ssh access and
# optionally update UID and GID when invoking the container with the entrypoint script
COPY ./docker/sshd_entrypoint.sh /sshd_entrypoint.sh
RUN chmod 744 /sshd_entrypoint.sh

# create the credentials to be able to pull private repos using ssh
RUN mkdir /root/.ssh/ && ssh-keyscan github.com | tee -a /root/.ssh/known_hosts

RUN echo "session required pam_limits.so" | tee --append /etc/pam.d/common-session > /dev/null

WORKDIR ${HOME}
34 changes: 34 additions & 0 deletions Dockerfile.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
ARG BASE_TAG=22.04
FROM ubuntu:${BASE_TAG} as build-stage
ENV DEBIAN_FRONTEND=noninteractive

RUN apt-get update && apt-get install -y \
autoconf \
cmake \
g++ \
gcc \
libtool \
make \
wget \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*
WORKDIR /tmp
ARG PROTOBUF_VERSION=21.0
RUN wget -O protobuf-cpp-"${PROTOBUF_VERSION}".tar.gz \
https://github.com/protocolbuffers/protobuf/releases/download/v${PROTOBUF_VERSION}/protobuf-cpp-3.${PROTOBUF_VERSION}.tar.gz \
&& tar -xzf protobuf-cpp-"${PROTOBUF_VERSION}".tar.gz \
&& rm protobuf-cpp-"${PROTOBUF_VERSION}".tar.gz
WORKDIR /tmp/protobuf-3."${PROTOBUF_VERSION}"
RUN ./autogen.sh \
&& ./configure \
&& make -j $(nproc --ignore=1) \
&& make install
FROM ubuntu:${BASE_TAG} as google-dependencies
COPY --from=build-stage /usr/local/include/google /usr/local/include/google
COPY --from=build-stage /usr/local/lib/libproto* /usr/local/lib/
COPY --from=build-stage /usr/local/bin/protoc /usr/local/bin
RUN ldconfig
Loading

0 comments on commit fb7c9e9

Please sign in to comment.