From 1cfa3bc4ee938c372d3cb539169dc7a48a277667 Mon Sep 17 00:00:00 2001 From: mo khan Date: Mon, 26 May 2025 09:23:10 -0600 Subject: chore: use dumb-init to manage pid 1 --- Dockerfile | 2 ++ bin/entrypoint.sh | 9 ++++++--- share/man/DEVELOPMENT.md | 2 ++ 3 files changed, 10 insertions(+), 3 deletions(-) diff --git a/Dockerfile b/Dockerfile index 030b528..ef47686 100644 --- a/Dockerfile +++ b/Dockerfile @@ -8,6 +8,7 @@ RUN go build -o /bin/authzd ./cmd/authzd/main.go FROM envoyproxy/envoy:v1.34-latest EXPOSE 8080 9901 10000 10003 +RUN apt-get update && apt-get install -y dumb-init && rm -rf /var/lib/apt/lists/* WORKDIR /opt/sparkle/ RUN mkdir -p bin etc public COPY --from=build /bin/authzd bin/authzd @@ -16,4 +17,5 @@ COPY --from=build /app/public public COPY etc/ etc COPY bin/*.sh bin/ RUN chmod +x bin/*.sh +ENTRYPOINT ["/usr/bin/dumb-init", "--"] CMD ["/opt/sparkle/bin/entrypoint.sh"] diff --git a/bin/entrypoint.sh b/bin/entrypoint.sh index eb7dc07..a770286 100755 --- a/bin/entrypoint.sh +++ b/bin/entrypoint.sh @@ -1,8 +1,11 @@ -#!/bin/sh - +#!/usr/bin/dumb-init /bin/sh +# shellcheck shell=sh set -e [ -n "$DEBUG" ] && set -x cd "$(dirname "$0")/.." -./bin/envoy.sh & ./bin/authzd & ./bin/sparkled + +./bin/envoy.sh & # launch envoy in background +./bin/authzd & # launch authzd in background +./bin/sparkled # launch sparkled in foreground diff --git a/share/man/DEVELOPMENT.md b/share/man/DEVELOPMENT.md index cc5fe5e..5c72d91 100644 --- a/share/man/DEVELOPMENT.md +++ b/share/man/DEVELOPMENT.md @@ -66,6 +66,8 @@ and set the `OAUTH_CLIENT_ID` and `OAUTH_CLIENT_SECRET`. You can refer to the `Dockerfile` in the root of this repository to determine the exact version of Envoy required. To install Envoy locally, follow the [official installation guide](https://www.envoyproxy.io/docs/envoy/latest/start/install). +To install [dumb-init](https://github.com/Yelp/dumb-init) see the +[documentation](https://github.com/Yelp/dumb-init). Sparkle uses the following Envoy Filters: -- cgit v1.2.3