forked from dependency-check/DependencyCheck
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild-docker.sh
More file actions
executable file
·27 lines (22 loc) · 1.17 KB
/
build-docker.sh
File metadata and controls
executable file
·27 lines (22 loc) · 1.17 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
#!/bin/bash
set -euo pipefail
VERSION=$(mvn -q \
-Dexec.executable="echo" \
-Dexec.args='${project.version}' \
--non-recursive \
org.codehaus.mojo:exec-maven-plugin:3.5.1:exec)
FILE=./cli/target/dependency-check-$VERSION-release.zip
if [ ! -f "$FILE" ]; then
echo "$FILE does not exist - run 'mvn package' first"
exit 1
fi
if ! docker info -f '{{ .DriverStatus }}' | grep "driver-type io.containerd.snapshotter" >/dev/null; then
echo "Docker Engine is not running with the containerd snapshotter - this is currently needed to build and test ODC multi-platform images using docker buildx."
echo "If using Docker Desktop, enable \"Use containerd for pulling and storing images\" per https://docs.docker.com/desktop/settings-and-maintenance/settings/#general"
echo "For more technical information on Docker Engine, see https://docs.docker.com/engine/storage/containerd/"
exit 1
fi
extra_tag_args="$([[ ! $VERSION = *"SNAPSHOT"* ]] && echo "--tag owasp/dependency-check:latest" || echo "")"
docker buildx build --pull --load --platform linux/amd64,linux/arm64 . \
--build-arg VERSION=$VERSION \
--tag owasp/dependency-check:$VERSION ${extra_tag_args}