Sign inSign up

chrisgatt/cpp-python-dev

By chrisgatt

Updated over 5 years ago

docker images to support C++ and Python developments

Image
1

10K+

chrisgatt/cpp-python-dev repository overview

Docker images to support development on C++ and Python stacks

Docker Repository on Quay

Introduction

That project produces Docker images, hosted on dedicated public Docker Cloud site. Those Docker images are intended to bring Linux-based ready-to-use environment for C++ and Python developers. Both programming languages are related as Python is built on top of C++ (e.g., a few Python modules need to be compiled with C++). Some basic support for R is also provided.

The supported Linux distributions are CentOS 8, CentOS 7, Fedora 33, Ubuntu 20.04 LTS (Focal Fossa), Ubuntu 18.04 LTS (Bionic Beaver), Ubuntu 16.04 LTS (Xenial Xerus), Debian 10 (Buster) and Debian 9 (Stretch). Debian 11 (Bullseye, release expected around May 2021) may be supported next.

Every time some changes are committed on the project's GitHub repository, the Docker images are automatically rebuilt and pushed onto Docker Cloud.

When some more components are needed, which may be of interest to other C++ and Python developers, the Docker image may be amended so as to add those extra components. The preferred way to propose amendment of the Docker image is through pull requests on the GitHub project. Once the pull request has been merged, i.e., once the Dockerfile amendment has been committed in GitHub, Docker Cloud then rebuilds the corresponding Docker images, which become available for every one to use.

See also

Images on Docker Cloud

Using the pre-built development images

  • Start the Docker container featuring the target Linux distribution (<linux-distrib> may be one of centos8, centos7, ubuntu2004, ubuntu1804, ubuntu1604, debian10 or debian9):
$ docker pull cpppythondevelopment/base:<linux-distrib>
$ docker run --rm -v ~/.ssh/id_rsa:/home/build/.ssh/id_rsa -v ~/.ssh/id_rsa.pub:/home/build/.ssh/id_rsa.pub -it cpppythondevelopment/base:<linux-distrib>
[[email protected] dev]$ 
  • Setup the user names and email addresses as environment variables for subsequent settings. If you intend to contribute to Fedora/CentOS/RedHat packaging, they should match as much as possible with Pagure, the Fedora Git repository(otherwise, just ignore the RPM packaging part):
[[email protected] dev]$ export FULLNAME="Firstname Lastname"
[[email protected] dev]$ export EMAIL="[email protected]"
  • Setup the user name and email address for Git:
[[email protected] dev]$ git config --global user.name "$FULLNAME"
[[email protected] dev]$ git config --global user.email "$EMAIL"
  • Setup the user names and email address for the RPM packaging:
[[email protected] dev]$ sed -i -e "s/Firstname Lastname/$FULLNAME/g" ~/.rpmmacros
[[email protected] dev]$ sed -i -e "s/[email protected]/$EMAIL/g" ~/.rpmmacros
  • Clone some C++-based project (e.g., OpenTREP is used as an example here):
[[email protected] dev]$ git clone https://github.com/trep/opentrep.git
Cloning into 'opentrep'...
remote: Enumerating objects: 44, done.
remote: Counting objects: 100% (44/44), done.
remote: Compressing objects: 100% (35/35), done.
Receiving objects: 100% (5813/5813), 61.53 MiB | 211.00 KiB/s, done.
remote: Total 5813 (delta 12), reused 19 (delta 8), pack-reused 5769
Resolving deltas: 100% (3665/3665), done.
[[email protected] dev]$ cd opentrep
[[email protected] opentrep (trunk)]$ 
  • Do some development:
[[email protected] opentrep (trunk)]$ export INSTALL_BASEDIR="${HOME}/dev/deliveries" && if [ -d /usr/lib64 ]; then LIBSUFFIX=64; fi && export LIBSUFFIX_4_CMAKE="-DLIB_SUFFIX=${LIBSUFFIX}"
[[email protected] opentrep (trunk)]$ rm -rf build && mkdir build && cd build
[[email protected] build (trunk)]$ cmake3 -DCMAKE_INSTALL_PREFIX=${INSTALL_BASEDIR}/opentrep-latest  -DCMAKE_BUILD_TYPE:STRING=Debug -DINSTALL_DOC:BOOL=OFF -DRUN_GCOV:BOOL=OFF ${LIBSUFFIX_4_CMAKE} ..
[[email protected] build (trunk)]$ make install
[[email protected] build (trunk)]$ ./opentrep/opentrep-indexer -t sqlite
[[email protected] build (trunk)]$ ./opentrep/opentrep-searcher -t sqlite -q "nce sfo"
[[email protected] build (trunk)]$ exit

Customize a Docker Image

The images may be customized, and pushed to Docker Cloud; <linux-distrib> may be one of centos8, centos7, ubuntu2004, ubuntu1804, ubuntu1604, debian10 or debian9:

$ mkdir -p ~/dev
$ cd ~/dev
$ git clone https://github.com/cpp-projects-showcase/docker-images.git cpp-docker-images
$ cd cpp-docker-images
$ vi <linux-distrib>/Dockerfile
$ docker build -t cpppythondevelopment/base:<linux-distrib> <linux-distrib>/
$ docker run --rm -v ~/.ssh/id_rsa:/home/build/.ssh/id_rsa -v ~/.ssh/id_rsa.pub:/home/build/.ssh/id_rsa.pub -it cpppythondevelopment/base:<linux-distrib>
[[email protected] cpp-projects-showcase]$ exit
$ docker push cpppythondevelopment/base:<linux-distrib>

TODO

For any of the following features, an issue may be open on GitHub:

  1. Support other Linux distributions, for instance Ubuntu 14.04 LTS
  2. Automate regular rebuilds (e.g., once a month for CentOS or Ubuntu)

Tag summary

Content type

Image

Digest

Size

1.2 GB

Last updated

over 5 years ago

docker pull chrisgatt/cpp-python-dev