From 1dace227bdbd6005c3a191ba8f620b928d2638ff Mon Sep 17 00:00:00 2001 From: Maarten Visscher Date: Sat, 27 Aug 2022 15:11:26 +0200 Subject: [PATCH] Docker: better init management. --- Dockerfile | 9 ++++++++- README.md | 4 ++-- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/Dockerfile b/Dockerfile index 8103e24..5b484c7 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,12 +1,19 @@ FROM python:3.10 +# I add Tini for better init management. +# See https://github.com/krallin/tini +ENV TINI_VERSION v0.19.0 +ADD https://github.com/krallin/tini/releases/download/${TINI_VERSION}/tini /tini +RUN chmod +x /tini + ENV PYTHONUNBUFFERED=1 WORKDIR /usr/src/app COPY requirements.txt ./ - RUN pip install --no-cache-dir -r requirements.txt # The .dockerignore file only includes necessary files/folders COPY . . RUN pip install --no-cache-dir . + +ENTRYPOINT ["/tini", "--", "/usr/local/bin/samil"] diff --git a/README.md b/README.md index ceb7884..0180483 100644 --- a/README.md +++ b/README.md @@ -40,7 +40,7 @@ The image is currently not built for ARM platforms like Raspberry Pi, so for these platforms you need to build it yourself or install via pip. ``` -docker run --network host mhvis/samil samil monitor +docker run --network host mhvis/samil monitor ``` Here is a sample `compose.yaml`: @@ -51,7 +51,7 @@ name: "samil" services: samil: image: mhvis/samil - command: samil monitor # Adapt as desired + command: monitor # Adapt as desired network_mode: host restart: unless-stopped ```