Skip to content

Commit

Permalink
entrypoint: Launch our entrypoint via tini
Browse files Browse the repository at this point in the history
Even single process containers (which this one is actually not) should
have an init system. However most init systems are too big and complex
for containerization purposes. [Dumb-init][0] (and tini init) address
this problem _specifically_ for Docker containers.

See the [dumb-init][0] documentation for more details.

[0]: https://github.com/Yelp/dumb-init

Signed-off-by: Olliver Schinagl <[email protected]>
  • Loading branch information
oliv3r committed Jun 10, 2023
1 parent 10fa7fc commit e7e1b3c
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 2 deletions.
3 changes: 3 additions & 0 deletions Dockerfile-alpine-slim.template
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,9 @@ RUN set -x \
# forward request and error logs to docker log collector
&& ln -sf /dev/stdout /var/log/nginx/access.log \
&& ln -sf /dev/stderr /var/log/nginx/error.log \
# Ensure we can run our entrypoint and make it debian compatible
&& apk add --no-cache tini \
&& ln -s /sbin/tini /usr/bin/tini \
# create a docker-entrypoint.d directory
&& mkdir /docker-entrypoint.d

Expand Down
5 changes: 4 additions & 1 deletion Dockerfile-alpine.template
Original file line number Diff line number Diff line change
Expand Up @@ -75,4 +75,7 @@ RUN set -x \
&& if [ -n "/etc/apk/keys/abuild-key.rsa.pub" ]; then rm -f /etc/apk/keys/abuild-key.rsa.pub; fi \
&& if [ -n "/etc/apk/keys/nginx_signing.rsa.pub" ]; then rm -f /etc/apk/keys/nginx_signing.rsa.pub; fi \
# Bring in curl and ca-certificates to make registering on DNS SD easier
&& apk add --no-cache curl ca-certificates
&& apk add --no-cache curl ca-certificates \
# Ensure we can run our entrypoint and do it compatible with alpine
&& apk add --no-cache tini \
&& ln -s /sbin/tini /usr/bin/tini
2 changes: 2 additions & 0 deletions Dockerfile-debian.template
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,8 @@ RUN set -x \
$nginxPackages \
gettext-base \
curl \
tini \
&& ln -s /usr/bin/tini /sbin/tini \
&& apt-get remove --purge --auto-remove -y && rm -rf /var/lib/apt/lists/* /etc/apt/sources.list.d/nginx.list \
\
# if we have leftovers from building, let's purge them (including extra, unnecessary build deps)
Expand Down
2 changes: 1 addition & 1 deletion entrypoint/docker-entrypoint.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/sh
#!/sbin/init /bin/sh
# vim:sw=4:ts=4:et

set -e
Expand Down

0 comments on commit e7e1b3c

Please sign in to comment.