XNAT Node/Java Build Container Image
To build the Docker container image locally:
- Build the image
- Tag it
- Push it to Docker Hub (optional)
$ docker build . $ docker build -t xnat/node-java-build:latest . $ docker login --username=harmitage --firstname.lastname@example.org $ docker push xnat/node-java-build
There are many ways you can build and deploy; this is just a basic procedure for that.
Building on Jenkins
This project includes a Jenkinsfile that defines a pipeline for building and deploying the Docker image automatically:
- When code is pushed to any branch in the repository the Docker image is built
- When code is pushed to the master branch of the repository the Docker image is deployed to Docker Hub
You can also build manually on the build server. In this case, you'll be prompted to specify a value for the parameter FORCE_DEPLOY. By default, this parameter is set to false. Setting it to true causes the build to deploy the generated image to Docker Hub, even when building from a branch other than master.
When a new image is built and pushed to Docker Hub, the image tag is based on the build number:
- If the build is on the master branch, the image tag is just the build number and is also tagged with latest
- If the build is on any branch other than the master branch (as in the case of a force deploy), the image tag is the build number plus the branch name, e.g. 10-develop (the latest tag is not updated)