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