diff --git a/docker/builder/Dockerfile b/docker/builder/Dockerfile index 6b72dd29..e71835d9 100644 --- a/docker/builder/Dockerfile +++ b/docker/builder/Dockerfile @@ -8,12 +8,14 @@ ARG BUILD_DRIVER=OFF ARG BUILD_BPF=OFF ARG BUILD_WARNINGS_AS_ERRORS=ON ARG MAKE_JOBS=4 +ARG FALCO_VERSION ENV BUILD_TYPE=${BUILD_TYPE} ENV BUILD_DRIVER=${BUILD_DRIVER} ENV BUILD_BPF=${BUILD_BPF} ENV BUILD_WARNINGS_AS_ERRORS=${BUILD_WARNINGS_AS_ERRORS} ENV MAKE_JOBS=${MAKE_JOBS} +ENV FALCO_VERSION=${FALCO_VERSION} ARG DOCKER_VERSION=1.11.0 ARG CMAKE_VERSION=3.5.0 diff --git a/docker/builder/root/usr/bin/entrypoint b/docker/builder/root/usr/bin/entrypoint index 110aa307..5c722eb8 100755 --- a/docker/builder/root/usr/bin/entrypoint +++ b/docker/builder/root/usr/bin/entrypoint @@ -25,6 +25,7 @@ case "$CMD" in -DBUILD_DRIVER="$BUILD_DRIVER" \ -DBUILD_BPF="$BUILD_BPF" \ -DBUILD_WARNINGS_AS_ERRORS="$BUILD_WARNINGS_AS_ERRORS" \ + -DFALCO_VERSION="$FALCO_VERSION" \ "$SOURCE_DIR/falco" exit "$(printf '%d\n' $?)" ;; diff --git a/docker/builder/root/usr/bin/usage b/docker/builder/root/usr/bin/usage index 900c99b3..b77a5e40 100755 --- a/docker/builder/root/usr/bin/usage +++ b/docker/builder/root/usr/bin/usage @@ -21,11 +21,13 @@ How to use. - a bind-mount on the source directory (ie., the directory containing falco and sysdig source as siblings) Optionally, you can also bind-mount the build directory. + So, you can execute it from the Falco root directory as follows. * docker run -v $PWD/..:/source -v $PWD/build:/build -ti falcosecurity/falco-builder cmake * docker run -v $PWD/..:/source -v $PWD/build:/build -ti falcosecurity/falco-builder [, ..., ] How to build. + * cd docker/builder && DOCKER_BUILDKIT=1 docker build -t falcosecurity/falco-builder . In case you want to customise the builder at build time the following build arguments are provided: @@ -34,10 +36,12 @@ How to build. - BUILD_BPF whether to build the BPF driver or not (defaults to "OFF") - BUILD_WARNINGS_AS_ERRORS whether to intend warnings as errors or not (defaults to "ON") - MAKE_JOBS the number of jobs to use during make (defaults to "4") + - FALCO_VERSION the version to label the build (built from git index in case it is missing) - It is possible to change these at runtime (in the container) since environment variables with the same names are provided. + It is possible to change these at runtime (in the container) since environment variables with the same names are provided, too. Environment. + * ${gccversion} * cplusplus ${cppversion} * ${cmakeversion} diff --git a/userspace/falco/falco.cpp b/userspace/falco/falco.cpp index b414d645..dc957397 100644 --- a/userspace/falco/falco.cpp +++ b/userspace/falco/falco.cpp @@ -76,7 +76,7 @@ static void restart_falco(int signal) static void usage() { printf( - "Falco version is " FALCO_VERSION "\n" + "Falco version: " FALCO_VERSION "\n" "Usage: falco [options]\n\n" "Options:\n" " -h, --help Print this page\n" @@ -604,7 +604,7 @@ int falco_init(int argc, char **argv) case 0: if(string(long_options[long_index].name) == "version") { - printf("falco version %s\n", FALCO_VERSION); + printf("Falco version: %s\n", FALCO_VERSION); return EXIT_SUCCESS; } else if (string(long_options[long_index].name) == "cri")