/image_builder

Creates docker images for the cyber-dojo language test frameworks

Primary LanguageShellBSD 2-Clause "Simplified" LicenseBSD-2-Clause

image_builder

image_build_test_push_notify.sh is the script (containing docker commands) which all the cyber-dojo-languages repos run in their .circleci/config.yml file.

There are two kinds of repos in the cyber-dojo-languages github organization:

  • baseLanguage repos
  • testFramework repos

baseLanguage repos

For example, python

  • contain a docker/Dockerfile.base which installs a base language
  • attempts to build the docker image, taking its name from the file docker/image_name.json
  • if successful:
    • tags the docker image with the 1st seven characters of the git commit sha
    • pushes the docker image to cyberdojofoundation on dockerhub

testFramework repos

For example, python-pytest.

  • contain a docker/Dockerfile.base which installs a test-framework
    • attempts to build the docker image, taking its name from the image_name property of start_point/manifest.json, with docker/Dockerfile.base augmented to fulfil the runner's requirements
    • verifies the start_point files, untweaked, give a red traffic-light
    • verifies the start_point files, tweaked to green, give a green traffic-light
    • verifies the start_point files, tweaked to amber, give an amber traffic-light
    • if successful:
      • tags this docker image with the 1st seven characters of the git commit sha
      • pushes this docker image to cyberdojofoundation on dockerhub (latest and sha tag)
  • contain start_point/ files for the test-framework
    • attempts to build a start-point image (with the name taken from the image_name property of start_point/manifest.json again
    • if successful:
      • tags the image_name of the start_point/manifest.json inside this image with the 1st seven characters of the git commit sha
      • tags the docker image with the 1st seven characters of the git commit sha
      • pushes this docker image to cyberdojostartpoints on dockerhub (latest and sha tag)

augmented Dockerfile

Un-augmented Dockerfiles cannot be used to build a (working) docker image with a docker build command. This is because runner has several requirements. All OS's need:

  • a Linux user called sandbox.
  • a Linux group called sandbox.
  • a /home/sandbox/ dir for the sandbox user's home dir.
  • bash to ensure every cyber-dojo.sh runs in the same shell.
  • file to check if a file is binary or text (--mime-encoding).
  • tar to tar pipe files out of the container.
  • truncate to truncate large files.

Note: There is a circular dependency which can occasionally bite you. Suppose image_builder is building the cyberdojofoundation/gcc-assert image. It will generate traffic-lights by running start-point files against a container run from that image using the cyberdojo/runner service. Now, cyberdojo/runner has its own tests which rely on start-points from a few language+testFrameworks, one of which is gcc-assert, which is, of course, built by image_builder.


cyber-dojo.org home page