diff --git a/docker/falco/Dockerfile.ubi b/docker/ubi/Dockerfile similarity index 93% rename from docker/falco/Dockerfile.ubi rename to docker/ubi/Dockerfile index 9281857b..75847f55 100644 --- a/docker/falco/Dockerfile.ubi +++ b/docker/ubi/Dockerfile @@ -33,14 +33,13 @@ RUN dnf -y update && \ && rm -rf /var/lib/apt/lists/* RUN mkdir /build && cd /build/ && curl --remote-name-all -L https://github.com/dell/dkms/archive/refs/tags/v3.0.3.tar.gz && \ - tar xvf v3.0.3.tar.gz && cd dkms-3.0.3 && make install-redhat && rm -rf /build + tar xvf v3.0.3.tar.gz && cd dkms-3.0.3 && make install-redhat && rm -rf /build RUN mkdir /deploy && cd /deploy/ && curl --remote-name-all -L https://download.falco.org/packages/bin/x86_64/falco-${FALCO_VERSION}-x86_64.tar.gz && \ - cd / && tar --strip-components=1 -xvf /deploy/falco-${FALCO_VERSION}-x86_64.tar.gz && \ + cd / && tar --strip-components=1 -xvf /deploy/falco-${FALCO_VERSION}-x86_64.tar.gz && \ rm -rf /deploy COPY ./docker-entrypoint.sh / -COPY ./docker-entrypoint-ubi.sh / -ENTRYPOINT ["/docker-entrypoint-ubi.sh"] +ENTRYPOINT ["/docker-entrypoint.sh"] CMD ["/usr/bin/falco"] diff --git a/docker/falco/docker-entrypoint-ubi.sh b/docker/ubi/docker-entrypoint.sh similarity index 66% rename from docker/falco/docker-entrypoint-ubi.sh rename to docker/ubi/docker-entrypoint.sh index 0b7e8ef4..03ab87fb 100755 --- a/docker/falco/docker-entrypoint-ubi.sh +++ b/docker/ubi/docker-entrypoint.sh @@ -1,6 +1,6 @@ #!/bin/bash # -# Copyright (C) 2021 The Falco Authors. +# Copyright (C) 2022 The Falco Authors. # # # Licensed under the Apache License, Version 2.0 (the "License"); @@ -15,9 +15,24 @@ # See the License for the specific language governing permissions and # limitations under the License. # + set -x rm -fr /usr/src/kernels/ && rm -fr /usr/src/debug/ rm -fr /lib/modules && ln -s $HOST_ROOT/lib/modules /lib/modules rm -fr /boot && ln -s $HOST_ROOT/boot /boot -exec /docker-entrypoint.sh "$@" +# Set the SKIP_DRIVER_LOADER variable to skip loading the driver + +if [[ -z "${SKIP_DRIVER_LOADER}" ]]; then + echo "* Setting up /usr/src links from host" + + for i in "$HOST_ROOT/usr/src"/* + do + base=$(basename "$i") + ln -s "$i" "/usr/src/$base" + done + + /usr/bin/falco-driver-loader +fi + +exec "$@"