From b170cd2850d8daa41e9e13e9d6424b635bcd1b1b Mon Sep 17 00:00:00 2001 From: Kromonos Date: Tue, 27 Dec 2022 19:39:18 +0100 Subject: [PATCH] Add docker healthcheck feature & move collectstatic into container (#276) --- docker/Dockerfile | 1 + docker/docker-compose.yml | 9 ++++++++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/docker/Dockerfile b/docker/Dockerfile index 44eed35..4e9f250 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -17,6 +17,7 @@ COPY requirements.txt requirements.txt RUN apt-get update \ && apt-get install -y --no-install-recommends \ + netcat \ gcc \ libc6-dev \ libpq-dev \ diff --git a/docker/docker-compose.yml b/docker/docker-compose.yml index 851a571..0ae9180 100644 --- a/docker/docker-compose.yml +++ b/docker/docker-compose.yml @@ -49,6 +49,11 @@ services: web: <<: *takahe-common + healthcheck: + test: ["CMD", "nc", "-z", "-v", "localhost", "8000"] + interval: 20s + timeout: 60s + start_period: 15s ports: - "8000:8000" @@ -58,7 +63,9 @@ services: setup: <<: *takahe-common - command: ["/takahe/manage.py", "migrate"] + restart: "no" + command: > + bash -c "/takahe/manage.py migrate && /takahe/manage.py collectstatic --noinput" networks: internal_network: