- Dockerized build of CERN's Cling.
- Based on Ubuntu 14.04. (can be changed in the
Dockerfile
)
- Install docker
- Get the image from Docker Hub or build it yourself
- Use it like any other docker image
# get the build from docker hub
docker pull maddouri/cling-ubuntu-docker
# run it ! (the entry point is cling)
docker run -it maddouri/cling-ubuntu-docker
# get the Dockerfile
git clone https://github.com/maddouri/cling-ubuntu-docker.git
cd cling-ubuntu-docker
# depending on your machine, this might take a while to finish building
docker build -t my_cling_image .
# run it ! (the entry point is cling)
docker run -it my_cling_image
alias cling='docker run -it maddouri/cling-ubuntu-docker'
As with any other Docker images, you can access your file system from the container by attaching volumes to it:
Syntax:
docker run -v /path/to/host/folder:/path/to/container/folder -it maddouri/cling-ubuntu-docker
Usage example:
$ ls /media/data/myCode
func.cpp
$ cat func.cpp
#include <iostream>
void sayHi() {
std::cout << "Hello Dockerized Cling !" << std::endl;
}
$ docker run -v /media/data/myCode:/code -it maddouri/cling-ubuntu-docker
****************** CLING ******************
* Type C++ code and press enter to run it *
* Type .q to exit *
*******************************************
[cling]$ .L /code/func.cpp
[cling]$ sayHi()
Hello Dockerized Cling !
[cling]$ .q
$ # back to the host machine
# NB: use "-i" instead of "-it" when piping
echo -e '#include <iostream>\n std::cout << "Hello Dockerized Cling !" << std::endl;' | docker run -i maddouri/cling-ubuntu-docker
# use bash as the new entry point
docker run -it --entrypoint=/bin/bash maddouri/cling-ubuntu-docker
Due to an issue, I couldn't get a precompiled version of cling for my Ubuntu 16.04 machine, neither did the current sources compile on my platform. (GCC 5 not supported)
When building an image, build-cling.sh
clones the latest commit available from CERN's repository.
The exact commit SHA1 can be found in the ${CLING_COMMIT_SHA1}
file:
docker run -it --entrypoint=/bin/bash maddouri/cling-ubuntu-docker
cat ${CLING_COMMIT_SHA1}
After trying both Docker Hub's "Automated Builds" and Travis CI, it turns out that the images can't be built using those services -- in both cases, the build requires more time than the allowed amount.
For this reason, I will be pushing non-automated builds to Docker Hub. (until I figure out a better solution)
The content of the Github repository is available under the 3-Clause BSD license.
However, cling, llvm and clang (i.e. in the built docker image) have different licenses.
IANAL, so if the content of this repository does not comply with a given license, please contact me or create a Github issue in order to fix that :)