diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..567609b --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +build/ diff --git a/CMakeLists.txt b/CMakeLists.txt new file mode 100644 index 0000000..7e2025d --- /dev/null +++ b/CMakeLists.txt @@ -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() diff --git a/README.md b/README.md index 14b28fd..acbda7f 100644 --- a/README.md +++ b/README.md @@ -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. @@ -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. + diff --git a/ecal-base-archlinux/Dockerfile b/ecal-base-archlinux/Dockerfile index d674fa5..537bc73 100644 --- a/ecal-base-archlinux/Dockerfile +++ b/ecal-base-archlinux/Dockerfile @@ -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 diff --git a/ecal/Dockerfile b/ecal/Dockerfile index 68561dc..dd0f9af 100644 --- a/ecal/Dockerfile +++ b/ecal/Dockerfile @@ -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