Skip to content

Commit

Permalink
Added CMakeLists.txt for easier building. Use "make install" instead …
Browse files Browse the repository at this point in the history
…of the OS package manager.
  • Loading branch information
Blutkoete committed Sep 9, 2020
1 parent 5f76978 commit 0493159
Show file tree
Hide file tree
Showing 5 changed files with 104 additions and 6 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
build/
92 changes: 92 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
cmake_minimum_required(VERSION 3.13)

project(docker-ecal)

option(DOCKER_ECAL_UPGRADE_OS_BASE "Upgrade (pull) the OS base images" OFF)
option(DOCKER_ECAL_USE_CACHE "Use cache when building docker images" ON)
option(DOCKER_ECAL_BUILD_BIONIC "Build with Ubuntu Bionic Beaver as a base" ON)
option(DOCKER_ECAL_BUILD_FOCAL "Build with Ubuntu Focal Fossa as a base" ON)
option(DOCKER_ECAL_BUILD_ARCHLINUX "Build with ArchLinux as a base" ON)
option(DOCKER_ECAL_BUILD_ARCHLINUX_AUR "Build with Archlinux as a base for AUR package development" ON)
option(DOCKER_ECAL_BUILD_V5_6_0 "Build image for eCAL v5.6.0" ON)
option(DOCKER_ECAL_BUILD_V5_7_1 "Build image for eCAL v5.7.1" ON)

add_custom_target(docker-ecal ALL)

if(${CMAKE_SYSTEM_PROCESSOR} STREQUAL "x86_64")
set(DOCKER_ECAL_ARCH "amd64")
endif()

if(${DOCKER_ECAL_UPGRADE_OS_BASE})
set(DOCKER_ECAL_PULL "--pull")
endif()

if(NOT ${DOCKER_ECAL_USE_CACHE})
set(DOCKER_ECAL_CACHE "--no-cache")
endif()

if(DOCKER_ECAL_BUILD_BIONIC)
add_custom_target(ecal-base-bionic
docker build ${DOCKER_ECAL_CACHE} ${DOCKER_ECAL_PULL} --tag blutkoete/ecal-base:latest-bionic-${DOCKER_ECAL_ARCH} ${CMAKE_SOURCE_DIR}/ecal-base-bionic)
add_dependencies(docker-ecal ecal-base-bionic)

if(DOCKER_ECAL_BUILD_V5_6_0)
add_custom_target(ecal-bionic-v5_6_0
docker build ${DOCKER_ECAL_CACHE} --tag blutkoete/ecal:v5.6.0-bionic-${DOCKER_ECAL_ARCH} --build-arg TAG=v5.6.0 --build-arg OS=bionic --build-arg ARCH=${DOCKER_ECAL_ARCH} ${CMAKE_SOURCE_DIR}/ecal)
add_dependencies(ecal-bionic-v5_6_0 ecal-base-bionic)
add_dependencies(docker-ecal ecal-bionic-v5_6_0)
endif()

if(DOCKER_ECAL_BUILD_V5_7_1)
add_custom_target(ecal-bionic-v5_7_1
docker build ${DOCKER_ECAL_CACHE} --tag blutkoete/ecal:v5.7.1-bionic-${DOCKER_ECAL_ARCH} --build-arg TAG=v5.7.1 --build-arg OS=bionic --build-arg ARCH=${DOCKER_ECAL_ARCH} ${CMAKE_SOURCE_DIR}/ecal)
add_dependencies(ecal-bionic-v5_7_1 ecal-base-bionic)
add_dependencies(docker-ecal ecal-bionic-v5_7_1)
endif()
endif()

if(DOCKER_ECAL_BUILD_FOCAL)
add_custom_target(ecal-base-focal
docker build ${DOCKER_ECAL_CACHE} ${DOCKER_ECAL_PULL} --tag blutkoete/ecal-base:latest-focal-${DOCKER_ECAL_ARCH} ${CMAKE_SOURCE_DIR}/ecal-base-focal)
add_dependencies(docker-ecal ecal-base-focal)

if(DOCKER_ECAL_BUILD_V5_6_0)
add_custom_target(ecal-focal-v5_6_0
docker build ${DOCKER_ECAL_CACHE} --tag blutkoete/ecal:v5.6.0-focal-${DOCKER_ECAL_ARCH} --build-arg TAG=v5.6.0 --build-arg OS=focal --build-arg ARCH=${DOCKER_ECAL_ARCH} ${CMAKE_SOURCE_DIR}/ecal)
add_dependencies(ecal-focal-v5_6_0 ecal-base-focal)
add_dependencies(docker-ecal ecal-focal-v5_6_0)
endif()

if(DOCKER_ECAL_BUILD_V5_7_1)
add_custom_target(ecal-focal-v5_7_1
docker build ${DOCKER_ECAL_CACHE} --tag blutkoete/ecal:v5.7.1-focal-${DOCKER_ECAL_ARCH} --build-arg TAG=v5.7.1 --build-arg OS=focal --build-arg ARCH=${DOCKER_ECAL_ARCH} ${CMAKE_SOURCE_DIR}/ecal)
add_dependencies(ecal-focal-v5_7_1 ecal-base-focal)
add_dependencies(docker-ecal ecal-focal-v5_7_1)
endif()
endif()

if(DOCKER_ECAL_BUILD_ARCHLINUX)
add_custom_target(ecal-base-archlinux
docker build ${DOCKER_ECAL_CACHE} ${DOCKER_ECAL_PULL} --tag blutkoete/ecal-base:latest-archlinux-${DOCKER_ECAL_ARCH} ${CMAKE_SOURCE_DIR}/ecal-base-archlinux)
add_dependencies(docker-ecal ecal-base-archlinux)

if(DOCKER_ECAL_BUILD_V5_6_0)
add_custom_target(ecal-archlinux-v5_6_0
docker build ${DOCKER_ECAL_CACHE} --tag blutkoete/ecal:v5.6.0-archlinux-${DOCKER_ECAL_ARCH} --build-arg TAG=v5.6.0 --build-arg OS=archlinux --build-arg ARCH=${DOCKER_ECAL_ARCH} ${CMAKE_SOURCE_DIR}/ecal)
add_dependencies(ecal-archlinux-v5_6_0 ecal-base-archlinux)
add_dependencies(docker-ecal ecal-archlinux-v5_6_0)
endif()

if(DOCKER_ECAL_BUILD_V5_7_1)
add_custom_target(ecal-archlinux-v5_7_1
docker build ${DOCKER_ECAL_CACHE} --tag blutkoete/ecal:v5.7.1-archlinux-${DOCKER_ECAL_ARCH} --build-arg TAG=v5.7.1 --build-arg OS=archlinux --build-arg ARCH=${DOCKER_ECAL_ARCH} ${CMAKE_SOURCE_DIR}/ecal)
add_dependencies(ecal-archlinux-v5_7_1 ecal-base-archlinux)
add_dependencies(docker-ecal ecal-archlinux-v5_7_1)
endif()
endif()

if(DOCKER_ECAL_BUILD_ARCHLINUX_AUR)
add_custom_target(ecal-base-archlinux-aur
docker build ${DOCKER_ECAL_CACHE} ${DOCKER_ECAL_PULL} --tag blutkoete/ecal-base:latest-archlinux-aur-${DOCKER_ECAL_ARCH} ${CMAKE_SOURCE_DIR}/ecal-base-archlinux-aur)
add_dependencies(docker-ecal ecal-base-archlinux-aur)
endif()
6 changes: 5 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ Inofficial Dockerfiles for [eCAL](https://github.com/continental/ecal).

Prebuilt docker images are available from [here](https://hub.docker.com/u/blutkoete).

Please note that the _ecal-base_ image install the prerequisites and then *clones* the full repository, the _ecal_ image then checkouts the requested tag, builds it and install the resulting DEB package. You will probably get a much smaller and faster-to-rebuild image by using the official DEB images from the eCAL release page.
Please note that the _ecal-base_ image install the prerequisites and then *clones* the full repository, the _ecal_ image then checkouts the requested tag, builds it and calls *make install*. You will probably get a much smaller and faster-to-rebuild image by using the official DEB images from the eCAL release page.

The _ecal-base-bionic_ and _ecal-base-focal_ Dockerfiles use no ARGs.

Expand All @@ -14,3 +14,7 @@ The _ecal_ Dockerfile uses the following ARGs (--build-arg):
- *TAG*: The eCAL repository tag to check out, e.g. _v5.7.1_.

The _ecal-base-archlinux_ container may be used if you want to build eCAL yourself locally within an Arch Linux environment. The _ecal_base-archlinux-aur_ container pulls in the [AUR package](https://aur.archlinux.org/packages/ecal/) and is meant as a clean build environment for pushing new AUR package versions.

## Note on package managers
The _ecal_ image uses *make install* instead of the package manager of the base OS; this makes the Dockerfile easier, but is of course no clean way to provide a dependency if a dependent program or image relies on an installed Debian or Arch Linux package. In such cases, you will need to either install a dummy package yourself or call your package manager with the correct flag to make it assume a package as installed.

4 changes: 3 additions & 1 deletion ecal-base-archlinux/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,7 @@ RUN sed -i '/ %wheel ALL=(ALL) NOPASSWD: ALL/s/^# //g' /etc/sudoers
USER 1306
RUN mkdir -p /home/ecal/Werkbank/c_c++/
WORKDIR /home/ecal/Werkbank/c_c++/
RUN git clone https://github.org/continental/ecal.git
RUN git clone https://github.com/continental/ecal.git
WORKDIR /home/ecal/Werkbank/c_c++/ecal/
RUN git submodule init
RUN git submodule update
7 changes: 3 additions & 4 deletions ecal/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,11 @@ ARG TAG
RUN git checkout ${TAG}
RUN mkdir -p /home/ecal/Werkbank/c_c++/ecal/_build
WORKDIR /home/ecal/Werkbank/c_c++/ecal/_build
RUN cmake .. -DCMAKE_BUILD_TYPE=Release -DECAL_THIRDPARTY_BUILD_PROTOBUF=OFF -DECAL_THIRDPARTY_BUILD_CURL=OFF -DECAL_THIRDPARTY_BUILD_HDF5=OFF -DCMAKE_INSTALL_SYSCONFDIR=/etc && \
make -j4 && \
cpack -G DEB
RUN cmake .. -DCMAKE_BUILD_TYPE=Release -DECAL_THIRDPARTY_BUILD_PROTOBUF=OFF -DECAL_THIRDPARTY_BUILD_CURL=OFF -DECAL_THIRDPARTY_BUILD_HDF5=OFF -DCMAKE_INSTALL_PREFIX=/usr -DCMAKE_INSTALL_SYSCONFDIR=/etc && \
make -j4

USER 0
RUN dpkg -i /home/ecal/Werkbank/c_c++/ecal/_build/_deploy/eCAL-*
RUN make install

USER 1306
WORKDIR /home/ecal

0 comments on commit 0493159

Please sign in to comment.