Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bridge: add check for missing dynamic libs #1517

Merged
merged 1 commit into from
Nov 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions bridge/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
13 changes: 13 additions & 0 deletions bridge/scripts/check-deps.sh
Original file line number Diff line number Diff line change
@@ -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