Appendix F — Build Docker image
Build and test
# create the Java library
mvn clean install
# create the docker base image
docker compose -f docker/build.yml build app
The docker compose build
command has multiple --build-arg
arguments to override defaults:
QA_CATALOGUE_VERSION
: the QA catalogue version (default:0.7.0
, current development version is0.8.0-SNAPSHOT
)QA_CATALOGUE_WEB_VERSION
: it might be a released version such as0.7.0
, ormain
(default) to use the main branch, ordevelop
to use the develop branch.SOLR_VERSION
: the Apache Solr version you would like to use (default:8.11.1
)SOLR_INSTALL_SOURCE
: if its value isremote
docker will download it from http://archive.apache.org/. If its value is a local path points to a previously downloaded package (named assolr-${SOLR_VERSION}.zip
up to version 8.x.x orsolr-${SOLR_VERSION}.tgz
from version 9.x.x) the process will copy it from the host to the image file. Depending on the internet connection, download might take a long time, using a previously downloaded package speeds the building process. (Note: it is not possible to specify files outside the current directory, not using symbolic links, but you can create hard links - see an example below.)
Using the current developer version:
docker compose -f docker/build.yml build app \
--build-arg QA_CATALOGUE_VERSION=0.8.0-SNAPSHOT \
--build-arg QA_CATALOGUE_WEB_VERSION=develop \
--build-arg SOLR_VERSION=8.11.3
Using a downloaded Solr package:
# create link temporary
mkdir download
ln ~/Downloads/solr/solr-8.11.3.zip download/solr-8.11.3.zip
# run docker
docker compose -f docker/build.yml build app \
--build-arg QA_CATALOGUE_VERSION=0.8.0-SNAPSHOT \
--build-arg QA_CATALOGUE_WEB_VERSION=develop \
--build-arg SOLR_VERSION=8.11.3 \
--build-arg SOLR_INSTALL_SOURCE=download/solr-8.11.3.zip
# delete the temporary link
rm -rf download
Then start the container with environment variable IMAGE
set to metadata-qa-marc
and run analyses as described above.
For maintainers only:
Upload to Docker Hub:
docker tag metadata-qa-marc:latest pkiraly/metadata-qa-marc:latest
docker login
docker push pkiraly/metadata-qa-marc:latest
Cleaning before and after:
# stop running container
docker stop $(docker ps --filter name=metadata-qa-marc -q)
# remove container
docker rm $(docker ps -a --filter name=metadata-qa-marc -q)
# remove image
docker rmi $(docker images metadata-qa-marc -q)
# clear build cache
docker builder prune -a -f