From 023aade995e009aaa4474c03f271e869a0974ef0 Mon Sep 17 00:00:00 2001 From: Patrick Jentsch Date: Mon, 8 Jun 2020 10:14:15 +0200 Subject: [PATCH] Some changes for convinience --- daemon/.dockerignore | 3 +++ daemon/Dockerfile | 12 +++--------- daemon/docker-entrypoint.sh | 3 ++- daemon/{nopaqued.bak.py => nopaqued.py.bak} | 0 docker-compose.yml | 5 +++-- web/.dockerignore | 3 +++ web/Dockerfile | 10 ++-------- 7 files changed, 16 insertions(+), 20 deletions(-) create mode 100644 daemon/.dockerignore rename daemon/{nopaqued.bak.py => nopaqued.py.bak} (100%) create mode 100644 web/.dockerignore diff --git a/daemon/.dockerignore b/daemon/.dockerignore new file mode 100644 index 00000000..96dbc1bd --- /dev/null +++ b/daemon/.dockerignore @@ -0,0 +1,3 @@ +Dockerfile +.dockerignore +*.bak diff --git a/daemon/Dockerfile b/daemon/Dockerfile index 52b8844e..a58d2bda 100644 --- a/daemon/Dockerfile +++ b/daemon/Dockerfile @@ -4,7 +4,7 @@ FROM python:3.6-slim-stretch LABEL maintainer="inf_sfb1288@lists.uni-bielefeld.de" -ARG docker_gid=998 +ARG docker_gid=999 ARG gid=1000 ARG uid=1000 ENV LANG=C.UTF-8 @@ -25,16 +25,10 @@ USER nopaqued WORKDIR /home/nopaqued -COPY ["logger", "logger"] -COPY ["notify", "notify"] -COPY ["tasks", "tasks"] -COPY ["decorators.py", "nopaqued.py", "requirements.txt", "./"] +COPY --chown=nopaqued:nopaqued [".", "."] RUN python -m venv venv \ && venv/bin/pip install --requirement requirements.txt \ && mkdir logs -COPY docker-entrypoint.sh /usr/local/bin/ - - -ENTRYPOINT ["docker-entrypoint.sh"] +ENTRYPOINT ["./docker-entrypoint.sh"] diff --git a/daemon/docker-entrypoint.sh b/daemon/docker-entrypoint.sh index e2f4d358..637d29a0 100755 --- a/daemon/docker-entrypoint.sh +++ b/daemon/docker-entrypoint.sh @@ -5,4 +5,5 @@ wait-for-it db:5432 --strict --timeout=0 echo "Waiting for web..." wait-for-it web:5000 --strict --timeout=0 -venv/bin/python nopaqued.py +source venv/bin/activate +python nopaqued.py diff --git a/daemon/nopaqued.bak.py b/daemon/nopaqued.py.bak similarity index 100% rename from daemon/nopaqued.bak.py rename to daemon/nopaqued.py.bak diff --git a/docker-compose.yml b/docker-compose.yml index 8b5c9992..bd8ba276 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -51,7 +51,7 @@ services: - "./web/migrations:/home/nopaque/migrations" - "./web/tests:/home/nopaque/tests" - "./web/config.py:/home/nopaque/config.py" - - "./web/docker-entrypoint.sh:/usr/local/bin/docker-entrypoint.sh" + - "./web/docker-entrypoint.sh:/home/nopaque/docker-entrypoint.sh" - "./web/nopaque.py:/home/nopaque/nopaque.py" - "./web/requirements.txt:/home/nopaque/requirements.txt" daemon: @@ -72,8 +72,9 @@ services: - "./logs:/home/nopaqued/logs" - "./daemon/logger:/home/nopaqued/logger" - "./daemon/notify:/home/nopaqued/notify" + - "./daemon/tasks:/home/nopaqued/tasks" - "./daemon/decorators.py:/home/nopaqued/decorators.py" - - "./daemon/docker-entrypoint.sh:/usr/local/bin/docker-entrypoint.sh" + - "./daemon/docker-entrypoint.sh:/home/nopaqued/docker-entrypoint.sh" - "./daemon/nopaqued.py:/home/nopaqued/nopaqued.py" - "./daemon/requirements.txt:/home/nopaqued/requirements.txt" db: diff --git a/web/.dockerignore b/web/.dockerignore new file mode 100644 index 00000000..96dbc1bd --- /dev/null +++ b/web/.dockerignore @@ -0,0 +1,3 @@ +Dockerfile +.dockerignore +*.bak diff --git a/web/Dockerfile b/web/Dockerfile index 80ab3920..6fe12f75 100644 --- a/web/Dockerfile +++ b/web/Dockerfile @@ -27,16 +27,10 @@ USER nopaque WORKDIR /home/nopaque -COPY ["app", "app"] -COPY ["migrations", "migrations"] -COPY ["tests", "tests"] -COPY ["config.py", "nopaque.py", "requirements.txt", "./"] +COPY --chown=nopaque:nopaque [".", "."] RUN python -m venv venv \ && venv/bin/pip install --requirement requirements.txt \ && mkdir logs -COPY ["docker-entrypoint.sh", "/usr/local/bin/"] - - -ENTRYPOINT ["docker-entrypoint.sh"] +ENTRYPOINT ["./docker-entrypoint.sh"]