Public | Automated Build

Last pushed: 4 months ago
Short Description
This docker image holds configuration and setup for running bm-render image tests.
Full Description

docker-build-tests

  • Builds the node js LTS image with required dependencies on the docker image
  • It is linked to our docker hub account, so any commits on this branch are automatically build and applied to image.
  • For credentials to dockerhub, please check ur admin wiki on our internal network.
  • This image also includes yarn

using alpine images / updating Dockerfile

We reduced the image size be building on top of alpine version of node docker images.
This requires to (explicitly) install in some packages to be able to npm/yarn install certain node dependencies.

The one dependency that this was tested with is canvas. As soon/long as we don't need canvas support for running tests inside docker, we might be able to drop most of the additionally installed packages.
(Some might still be required for other dependencies using npm/yarn install, that compile code during install.)

For being able to test that the image will work this is the procedure:

  1. enable last line in the docker file to test that js dependency can be installed. (For the version currently in use I last checked the package.json in the project bm-renderer-core, which might by now already be outdated.)
  2. run docker build . to create a local version of the image
  3. once you are done making changes to the Dockerfile, disable the last line again and commit your changes. (As stated above dockerhub is configured to build a new version of the image automatically for usage in CI.)

Testing the image

Docker Hub provides automated testing facilities through Docker Compose files:
Any files in the same folder as the Dockerfile that end with .test.yml will be considered a Compose file to be used for testing.
Docker Hub will perform a one-off execution of the sut service. This is where your test scripts are executed. Its return code is used to determine if the tests passed or failed.

(partly copied from a blog post and the related github repoabout how to do the same for more complex testing and more CI systems.)

We are using docker-hub.test.yml to add tests.

  • add some library globally, that have build time dependencies to the OS.
  • create an empty project and do some basic setup to test the folder structure works as expected

For finding libs that need dependencies you can run grep -lr 'postinstall' node_modules inside the project.

For running the tests locally that Docker Hub runs (this will report but not return the exit code of the test):

docker-compose -f docker-hub.test.yml up --build

Docker Cloud Info

  • The github repo is directly linked to https://cloud.docker.com using the same details as docker-hub credentials
  • Image namespace is bettermarks/docker-build-tests:latest
Docker Pull Command
Owner
bmdevopsuser
Source Repository