From 290ca7dd59eefc8f089ff11abf4a065915141e16 Mon Sep 17 00:00:00 2001 From: Andrew Gorcester Date: Mon, 25 Feb 2019 16:04:48 -0800 Subject: [PATCH] Update Dockerfile to use gunicorn w/ multithread (#807) * Update Dockerfile to use gunicorn w/ multithread * Update Dockerfile * Update Dockerfile --- serving/samples/helloworld-python/Dockerfile | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/serving/samples/helloworld-python/Dockerfile b/serving/samples/helloworld-python/Dockerfile index e0bfa7b31..831676420 100644 --- a/serving/samples/helloworld-python/Dockerfile +++ b/serving/samples/helloworld-python/Dockerfile @@ -8,11 +8,14 @@ WORKDIR $APP_HOME COPY . . # Install production dependencies. -RUN pip install Flask +RUN pip install Flask gunicorn # Service must listen to $PORT environment variable. # This default value facilitates local development. ENV PORT 8080 -# Run the web service on container startup. -CMD ["python", "app.py"] +# Run the web service on container startup. Here we use the gunicorn +# webserver, with one worker process and 8 threads. +# For environments with multiple CPU cores, increase the number of workers +# to be equal to the cores available. +CMD exec gunicorn --bind :$PORT --workers 1 --threads 8 app:app