summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormo khan <mo@mokhan.ca>2025-05-26 09:23:10 -0600
committermo khan <mo@mokhan.ca>2025-05-26 09:23:10 -0600
commit1cfa3bc4ee938c372d3cb539169dc7a48a277667 (patch)
treee33dca55a27ad168c322c45fc87fd53309c88a8b
parent3724af53df29f7be507e9dc55adbc81e9b694cd6 (diff)
chore: use dumb-init to manage pid 1
-rw-r--r--Dockerfile2
-rwxr-xr-xbin/entrypoint.sh9
-rw-r--r--share/man/DEVELOPMENT.md2
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: