From e3346650667653892e658812c6307cdf5b2c2f3c Mon Sep 17 00:00:00 2001 From: Daniel Langbein Date: Wed, 25 Nov 2020 19:59:43 +0100 Subject: [PATCH] fix: no stdout visible inside docker -> use unbuffered mode; use alpine version of python base image --- Dockerfile | 8 +++++--- docker-compose.yml | 7 +++---- src/logMeetingData.py | 2 +- 3 files changed, 9 insertions(+), 8 deletions(-) diff --git a/Dockerfile b/Dockerfile index ed59cdb..7771e32 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,10 +1,12 @@ -FROM python:3.8 +FROM python:3.8-alpine WORKDIR /usr/src/ COPY requirements.txt ./ -RUN pip install --no-cache-dir -r requirements.txt +RUN pip3 install --no-cache-dir -r requirements.txt COPY ./src/ ./ +RUN chmod +x ./logMeetingData.py -CMD [ "python", "./logMeetingData.py" ] \ No newline at end of file +# unbuffered output option otherwise script sleeps before any output appears +CMD [ "python", "-u", "./logMeetingData.py" ] diff --git a/docker-compose.yml b/docker-compose.yml index 55164f8..300b2ef 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -2,9 +2,8 @@ version: '3.7' services: dk-gen: build: . - environment: - - PYTHONPATH=/usr/src/ +# environment: +# - PYTHONPATH=/usr/src/ volumes: -# - ./src/:/usr/src/ - ./secret:/usr/secret - - ./data:/usr/data \ No newline at end of file + - ./data:/usr/data diff --git a/src/logMeetingData.py b/src/logMeetingData.py index f1a6da5..dc23d39 100755 --- a/src/logMeetingData.py +++ b/src/logMeetingData.py @@ -13,7 +13,7 @@ def sleepFiveMin(verbose=False): fiveMinutes = 5 * minute if verbose: - print("> Sleeping for five minutes ...") + print(">> Sleeping for five minutes <<") time.sleep(fiveMinutes)