infrahelpers/cpppython

By infrahelpers

Updated about 18 hours ago

Base image for development on C++ and/or Python

Image
Data Science
Machine Learning & AI
Developer Tools
1

10K+

Container images to support development with C++ and Python

Docker Cloud build statusContainer repository on Quay

Introduction

That project produces container (e.g., Docker) images, hosted on a dedicated public Docker Cloud site. Those container images are intended to bring Linux-based ready-to-use environment for C++ and Python developers. Both programming languages are indeed 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 Rocky Linux 9, CentOS 10 Stream (not officially released, as of end 2024; see also CentOS Stream 10 compose artifacts), CentOS 9 Stream, CentOS 8 Stream, Fedora 40, Fedora 39, Ubuntu 24.04 LTS (Noble Numbat), Ubuntu 22.04 LTS (Jammy Jellyfish), Ubuntu 20.04 LTS (Focal Fossa), Debian 12 (Bookworm), and Debian 11 (Bullseye).

Every time some changes are committed on the project's GitHub repository, the container 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 container 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 rocky9, centos9, centos8, fedora40, fedora39, debian12, debian11, ubuntu2404, ubuntu2204, or ubuntu2004):
$ docker pull infrahelpers/cpppython:<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 infrahelpers/cpppython:<linux-distrib>
[build@5..0 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):
[build@5..0 dev]$ export FULLNAME="Firstname Lastname"
[build@5..0 dev]$ export EMAIL="email@example.com"
  • Setup the user name and email address for Git:
[build@5..0 dev]$ git config --global user.name "$FULLNAME"
[build@5..0 dev]$ git config --global user.email "$EMAIL"
  • Setup the user names and email address for the RPM packaging:
[build@5..0 dev]$ sed -i -e "s/Firstname Lastname/$FULLNAME/g" ~/.rpmmacros
[build@5..0 dev]$ sed -i -e "s/email@example.com/$EMAIL/g" ~/.rpmmacros
  • Clone some C++-based project (e.g., OpenTREP is used as an example here):
[build@5..0 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.
[build@5..0 dev]$ cd opentrep
[build@5..0 opentrep (trunk)]$ 
  • Do some development:
[build@5..0 opentrep (trunk)]$ export INSTALL_BASEDIR="${HOME}/dev/deliveries" && if [ -d /usr/lib64 ]; then LIBSUFFIX=64; fi && export LIBSUFFIX_4_CMAKE="-DLIB_SUFFIX=${LIBSUFFIX}"
[build@5..0 opentrep (trunk)]$ rm -rf build && mkdir build && cd build
[build@5..0 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} ..
[build@5..0 build (trunk)]$ make install
[build@5..0 build (trunk)]$ ./opentrep/opentrep-indexer -t sqlite
[build@5..0 build (trunk)]$ ./opentrep/opentrep-searcher -t sqlite -q "nce sfo"
[build@5..0 build (trunk)]$ exit

Customize a Docker Image

The images may be customized, and pushed to Docker Cloud; <linux-distrib> may be one of rocky9, centos9, centos8, fedora40, fedora39, debian12, debian11, ubuntu2404, ubuntu2204, or ubuntu2004:

$ 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 infrahelpers/cpppython:<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 infrahelpers/cpppython:<linux-distrib>
[build@9..d cpp-projects-showcase]$ exit
$ docker push infrahelpers/cpppython:<linux-distrib>

TODO

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

  1. Automate regular rebuilds (e.g., once a month for CentOS or Ubuntu)

Docker Pull Command

docker pull infrahelpers/cpppython