update: falco builder image has FALCO_VERSION build arg and env var again

Signed-off-by: Leonardo Di Donato <leodidonato@gmail.com>
This commit is contained in:
Leonardo Di Donato
2019-07-16 16:58:23 +02:00
committed by Leo Di Donato
parent 9d4ed8e33e
commit 44f0633f47
4 changed files with 10 additions and 3 deletions

View File

@@ -8,12 +8,14 @@ ARG BUILD_DRIVER=OFF
ARG BUILD_BPF=OFF ARG BUILD_BPF=OFF
ARG BUILD_WARNINGS_AS_ERRORS=ON ARG BUILD_WARNINGS_AS_ERRORS=ON
ARG MAKE_JOBS=4 ARG MAKE_JOBS=4
ARG FALCO_VERSION
ENV BUILD_TYPE=${BUILD_TYPE} ENV BUILD_TYPE=${BUILD_TYPE}
ENV BUILD_DRIVER=${BUILD_DRIVER} ENV BUILD_DRIVER=${BUILD_DRIVER}
ENV BUILD_BPF=${BUILD_BPF} ENV BUILD_BPF=${BUILD_BPF}
ENV BUILD_WARNINGS_AS_ERRORS=${BUILD_WARNINGS_AS_ERRORS} ENV BUILD_WARNINGS_AS_ERRORS=${BUILD_WARNINGS_AS_ERRORS}
ENV MAKE_JOBS=${MAKE_JOBS} ENV MAKE_JOBS=${MAKE_JOBS}
ENV FALCO_VERSION=${FALCO_VERSION}
ARG DOCKER_VERSION=1.11.0 ARG DOCKER_VERSION=1.11.0
ARG CMAKE_VERSION=3.5.0 ARG CMAKE_VERSION=3.5.0

View File

@@ -25,6 +25,7 @@ case "$CMD" in
-DBUILD_DRIVER="$BUILD_DRIVER" \ -DBUILD_DRIVER="$BUILD_DRIVER" \
-DBUILD_BPF="$BUILD_BPF" \ -DBUILD_BPF="$BUILD_BPF" \
-DBUILD_WARNINGS_AS_ERRORS="$BUILD_WARNINGS_AS_ERRORS" \ -DBUILD_WARNINGS_AS_ERRORS="$BUILD_WARNINGS_AS_ERRORS" \
-DFALCO_VERSION="$FALCO_VERSION" \
"$SOURCE_DIR/falco" "$SOURCE_DIR/falco"
exit "$(printf '%d\n' $?)" exit "$(printf '%d\n' $?)"
;; ;;

View File

@@ -21,11 +21,13 @@ How to use.
- a bind-mount on the source directory (ie., the directory containing falco and sysdig source as siblings) - 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. 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 cmake
* docker run -v $PWD/..:/source -v $PWD/build:/build -ti falcosecurity/falco-builder [<cmake-target-x>, ..., <cmake-target-y>] * docker run -v $PWD/..:/source -v $PWD/build:/build -ti falcosecurity/falco-builder [<cmake-target-x>, ..., <cmake-target-y>]
How to build. How to build.
* cd docker/builder && DOCKER_BUILDKIT=1 docker build -t falcosecurity/falco-builder . * 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: 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_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") - 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") - 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. Environment.
* ${gccversion} * ${gccversion}
* cplusplus ${cppversion} * cplusplus ${cppversion}
* ${cmakeversion} * ${cmakeversion}

View File

@@ -76,7 +76,7 @@ static void restart_falco(int signal)
static void usage() static void usage()
{ {
printf( printf(
"Falco version is " FALCO_VERSION "\n" "Falco version: " FALCO_VERSION "\n"
"Usage: falco [options]\n\n" "Usage: falco [options]\n\n"
"Options:\n" "Options:\n"
" -h, --help Print this page\n" " -h, --help Print this page\n"
@@ -604,7 +604,7 @@ int falco_init(int argc, char **argv)
case 0: case 0:
if(string(long_options[long_index].name) == "version") 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; return EXIT_SUCCESS;
} }
else if (string(long_options[long_index].name) == "cri") else if (string(long_options[long_index].name) == "cri")