Skip to content

Scanning with the Lineai JavaScript Agent (Docker)

The Lineai JavaScript Agent for Docker provides an easy way to integrate Lineai scanning into your build process.

Pull and run the JavaScript agent image from your Lineai server registry:

Terminal window
docker run --pull always --rm --interactive \
--env AGENT_UUID="your-agent-uuid" \
--env AGENT_PASSWORD="your-agent-password" \
--volume /path/to/scan:/scan \
yourinstance.app.lineai.com/lineai_javascript:latest analyze \
--host https://yourinstance.app.lineai.com \
--application "Your Application" \
-p /scan

Docker options:

  • —pull always — ensures that you always get the newest image
  • —env AGENT_UUID / —env AGENT_PASSWORD — agent credentials
  • —volume — mounts the host directory to scan into the container
  • See Docker Documentation for more docker options.

When running a server with a self-signed certificate or internal certificate authority the following options can be used to add the certificate authority to the docker image.

  • —volume “/home/<user_dir>/cacerts/:/opt/lineai/certs” - mounts the directory containing your ca certificates into the docker image.
  • —env NODE_EXTRA_CA_CERTS=“/opt/lineai/certs/your-certificate.pem” - loads the certificate authorities from the pem file into the docker image.

The Lineai Java Agent for Docker can be used to scan artifacts in Jenkins pipelines.

Example:

stage('Lineai Scan with latest AWS image') {
when {
expression { BRANCH_NAME ==~ /(integration|v.*|feature\/.*)/ }
}
steps {
catchError(buildResult: 'SUCCESS', stageResult: 'FAILURE') {
// Publish Lineai Scan
sh('''
docker run --pull always --rm --interactive \
--env "AGENT_UUID=${AGENT_UUID}" \
--env "AGENT_PASSWORD=${AGENT_PASSWORD}" \
--volume ${PWD}:/scan \
yourinstance.app.lineai.com/lineai_javascript:latest analyze \
--host https://yourinstance.app.lineai.com \
--application "Your Application" \
-p /scan \
--scan-space-name "Development" \
-e
''')
}
}
}