docs(docker): usage and labels for falco-tester docker image

Signed-off-by: Leonardo Di Donato <leodidonato@gmail.com>
This commit is contained in:
Leonardo Di Donato 2019-07-18 10:46:24 +00:00 committed by Leo Di Donato
parent 533e8247fd
commit c4cd9e326a
3 changed files with 31 additions and 5 deletions

View File

@ -1,5 +1,9 @@
FROM centos:7
LABEL name="falcosecurity/falco-tester"
LABEL usage="docker run -v /boot:/boot:ro -v /var/run/docker.sock:/var/run/docker.sock -v $PWD/..:/source -v $PWD/build:/build -e FALCO_VERSION=<current_falco_version> --name <name> falcosecurity/falco-tester test"
LABEL maintainer="opensource@sysdig.com"
ENV FALCO_VERSION=
ENV BUILD_TYPE=release

View File

@ -27,13 +27,14 @@ case "$CMD" in
echo "Missing Falco version." >&2
exit 1
fi
if [ ! -f "$BUILD_DIR/$BUILD_TYPE/falco-$FALCO_VERSION-x86_64.deb" ]; then
PACKAGE="$BUILD_DIR/$BUILD_TYPE/falco-$FALCO_VERSION-x86_64.deb"
if [ ! -f "$PACKAGE" ]; then
echo "Package(s) not found." >&2
exit 1
fi
DOCKER_IMAGE_NAME="falcosecurity/falco:test"
echo "Building local docker image $DOCKER_IMAGE_NAME from latest debian package..."
cp "$BUILD_DIR/$BUILD_TYPE/falco-$FALCO_VERSION-x86_64.deb" $BUILD_DIR/$BUILD_TYPE/docker/local
cp "$PACKAGE" $BUILD_DIR/$BUILD_TYPE/docker/local
cd $BUILD_DIR/$BUILD_TYPE/docker/local
docker build --build-arg FALCO_VERSION="$FALCO_VERSION" -t "$DOCKER_IMAGE_NAME" .

View File

@ -1,17 +1,38 @@
#!/usr/bin/env bash
pythonversion=$(python -c 'import sys; version=sys.version_info[:3]; print("{0}.{1}.{2}".format(*version))')
pipversion=$(pip --version | cut -d' ' -f 1,2,5,6)
dockerversion=$(docker --version)
cat <<EOF
Hello, this is the Falco tester container.
How to use.
...
The default commands for the Falco tester image reports usage and environment info.
* docker run falcosecurity/falco-tester
* docker run falcosecurity/falco-tester usage
It supports bash.
* docker run -ti falcosecurity/falco-tester:chore-travis bash
To run Falco regression tests you need to provide:
- the docker socket
- the boot directory
- the source directory
- the directory where Falco has been built
- the environment variable FALCO_VARIABLE set to the value obtained during the Falco's build
Assuming you are running it from the Falco root directory, you can run it as follows.
* docker run -v /boot:/boot:ro -v /var/run/docker.sock:/var/run/docker.sock -v $PWD/..:/source -v $PWD/build:/build -e FALCO_VERSION=<current_falco_version> falcosecurity/falco-tester test
How to build.
...
* cd docker/builder && DOCKER_BUILDKIT=1 docker build -t falcosecurity/falco-tester .
Environment.
* ...
* python ${pythonversion}
* ${pipversion}
* ${dockerversion}
EOF