From 3c29e49cdb133bc0f0e1396b60b8d03d2c37fc8d Mon Sep 17 00:00:00 2001 From: Daniel Langbein Date: Mon, 12 Dec 2022 21:26:44 +0100 Subject: [PATCH] cleaner Dockerfile --- Dockerfile | 11 ++++++++--- docker-compose.yml | 10 ++++------ 2 files changed, 12 insertions(+), 9 deletions(-) diff --git a/Dockerfile b/Dockerfile index 45a5f7c..309c448 100644 --- a/Dockerfile +++ b/Dockerfile @@ -2,7 +2,7 @@ # - https://docs.docker.com/language/python/build-images/ FROM python:3.10-slim-buster -WORKDIR /usr/src/ +WORKDIR /app # Set timezone. # - https://dev.to/0xbf/set-timezone-in-your-docker-image-d22 @@ -11,11 +11,16 @@ WORKDIR /usr/src/ RUN apt update && apt install tzdata -y ENV TZ="Europe/Berlin" -COPY requirements.txt ./ +COPY requirements.txt . RUN pip3 install --no-cache-dir -r requirements.txt -COPY src/ ./ +COPY src/ . RUN chmod +x langfingaz/main.py +# pythonpath is required to import from self created modules ("from langfingaz ...") +ENV PYTHONPATH=/app/ +# unbuffered output, otherwise script sleeps before any output appears +ENV PYTHONUNBUFFERED=1 + ENTRYPOINT [ "python3", "./langfingaz/main.py" ] CMD [ "log-verbose" ] diff --git a/docker-compose.yml b/docker-compose.yml index 6fc0e0a..01b6fde 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,13 +1,11 @@ version: '3.7' services: bbb-status: + container_name: bbb-status build: . command: ["log-verbose"] # see main.py for available commandline arguments restart: unless-stopped - environment: - - PYTHONPATH=/usr/src/ # pythonpath is required to import from self created modules ("from langfingaz ...") - - PYTHONUNBUFFERED=1 # unbuffered output, otherwise script sleeps before any output appears volumes: - - ./secret:/usr/secret - - ./data:/usr/data - - ./plot:/usr/plot + - ./secret:/secret + - ./data:/data + - ./plot:/plot