From 7027e0c02bd58ba8e813d14337713976048ee02d Mon Sep 17 00:00:00 2001 From: mpeltriaux Date: Tue, 26 Apr 2022 10:09:58 +0200 Subject: [PATCH] Docker enhancement * optimizes image build dependency * increases gunicorn default number of workers --- Dockerfile | 2 +- docker-entrypoint.sh | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Dockerfile b/Dockerfile index ad61d714..6e35526c 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,4 @@ -FROM python:3.7 +FROM python:3.9-slim ENV PYTHONUNBUFFERED 1 WORKDIR /konova diff --git a/docker-entrypoint.sh b/docker-entrypoint.sh index 3e405b72..e9f2cea2 100755 --- a/docker-entrypoint.sh +++ b/docker-entrypoint.sh @@ -1,7 +1,7 @@ #!/bin/bash -# Start all needed services inside the container! - +# Start all needed services once the container is fired up! service nginx start service redis-server start celery -A konova worker --detach -gunicorn konova.wsgi:application --bind 0.0.0.0:8000 \ No newline at end of file +# Rule of thumb: (2*CPU)+1 as worker_num -> Use 5 as default (matches a dual core) +gunicorn --workers=5 konova.wsgi:application --bind=0.0.0.0:8000 \ No newline at end of file