Building Docker images from source¶
Pre-requisites¶
- git
- docker
- docker-compose
Customization¶
All the following commands are supposed to be executed from the root folder of the project.
If you want to build images specific to a version you can checkout a stable version of Steady. Usually the master branch holds a -SNAPSHOT version.
git checkout tags/release-3.2.5
Make a copy of the sample configuration:
cp docker/.env.sample docker/.env
Customize the file docker/.env to match your needs, make sure you set the version you want to build in VULAS_RELEASE.
In
docker/.envyou must configure at leastPOSTGRES_USER=, you should also configure theHAPROXY's user and password as well as the credentials to access the bugs' frontend
Generate JAVA archives¶
At this point, you are ready to build the JAR/WAR artifacts with the following command:
docker build --tag steady-generator:3.2.5 -f docker/Dockerfile . docker run -it --rm -v ${PWD}/docker:/exporter --env-file ./docker/.env -e mvn_flags=-DskipTests steady-generator:3.2.5
If the command above fails, add
-DreuseForks=Falseflag tomvn_flags. As shown in the example below.docker run -it --rm -v ${PWD}/docker:/exporter --env-file ./docker/.env -e mvn_flags='-DskipTests -DreuseForks=False' steady-generator:3.2.5In case you are running behind a proxy you need to configure it in the
--build-argarguments. Check the predefinedARGs documentation to know more.In case you'd like to avoid downloading all dependencies by reusing your local Maven repository, add a volume as follows
-v "$HOME/.m2":/root/.m2, see here for more information.
As a result, the folders docker/<component-name> will contain compiled JARs (or WARs, depending on the component). The folder docker/client-tools will be populated with the JARs for client side tools (CLI, plugins, patchanalyzer).
Additionally, you may want to make the artifacts available to the developers of your organization (e.g., through an internal Nexus or other artifact distribution system).
Generate Docker images¶
You are now ready to run the system with the generated archives and create the Docker images:
(cd docker && docker-compose -f docker-compose.build.yml build)
You can create and run containers from the generated images.
(cd docker && docker-compose -f docker-compose.yml -f docker-compose.build.yml --profile vdb --profile ui up -d)
To check everything started successfully, browse the page http://localhost:8033/haproxy?stats. All endpoints should appear as green.
usernameandpasswordcan be found in your.envfile, be also advised thatrest-backendcould take more than 30 seconds to be ready to answer HTTP requests
Run the following to stop all containers.
(cd docker && docker-compose -f docker-compose.yml -f docker-compose.build.yml --profile vdb --profile ui down)
Get going: