- The github repo is directly linked to https://cloud.docker.com using the same details as docker-hub credentials (check admin wiki)
- Every branch/commit pushed to github creates a tag with the name of the branch. (Sometimes it takes some minutes for the build to take place because it gets queued)
- Image namespace is bettermarks/docker-build-tests, when merging to master the tag
content of the image
- This image also includes
- Builds the node js image with required dependencies on the docker image
- all dependencies required to install node-sass and canvas
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:
- 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.)
docker build .to create a local version of the image
- 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
Dockerfilethat end with
.test.ymlwill be considered a Compose file to be used for testing.
Docker Hub will perform a one-off execution of the
sutservice. This is where your test scripts are executed. Its return code is used to determine if the tests passed or failed.
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