diff --git a/bridge/Dockerfile b/bridge/Dockerfile index 1312ec0a9..64411229b 100644 --- a/bridge/Dockerfile +++ b/bridge/Dockerfile @@ -65,6 +65,11 @@ RUN apt-get update ;\ USER appuser COPY --from=build /app/target/release/svix-bridge /usr/local/bin/svix-bridge +COPY scripts/check-deps.sh /usr/local/bin/check-deps.sh + +# Verify all the dynamic libs we depend on are present in the runtime stage +RUN /usr/local/bin/check-deps.sh /usr/local/bin/svix-bridge + EXPOSE 5000 # Will fail if there's no `svix-bridge.yaml` in the CWD or `SVIX_BRIDGE_CFG` is not set to a valid diff --git a/bridge/scripts/check-deps.sh b/bridge/scripts/check-deps.sh new file mode 100755 index 000000000..7441ea45d --- /dev/null +++ b/bridge/scripts/check-deps.sh @@ -0,0 +1,13 @@ +#!/bin/sh + +BINPATH=$1 + +IFS= +MISSING="$(ldd $BINPATH | grep 'not found')" + +# There'll be 1 linebreak for the empty case. Anything else and it means we +# caught some unexpected output from ldd. +if [ "1" != "$(echo $MISSING | wc -l)" ]; then + echo "Binary $BINPATH missing dependencies:\n$MISSING" + exit 1 +fi