Skip to content

Commit da49e1f

Browse files
authored
feat(run): Add timeout comment to Dockerfiles (GoogleCloudPlatform#5375)
## Description Fixes #<ISSUE-NUMBER> Note: It's a good idea to open an issue first for discussion. ## Checklist - [ ] I have followed [Sample Guidelines from AUTHORING_GUIDE.MD](https://github.com/GoogleCloudPlatform/python-docs-samples/blob/master/AUTHORING_GUIDE.md) - [ ] README is updated to include [all relevant information](https://github.com/GoogleCloudPlatform/python-docs-samples/blob/master/AUTHORING_GUIDE.md#readme-file) - [ ] **Tests** pass: `nox -s py-3.6` (see [Test Environment Setup](https://github.com/GoogleCloudPlatform/python-docs-samples/blob/master/AUTHORING_GUIDE.md#test-environment-setup)) - [ ] **Lint** pass: `nox -s lint` (see [Test Environment Setup](https://github.com/GoogleCloudPlatform/python-docs-samples/blob/master/AUTHORING_GUIDE.md#test-environment-setup)) - [ ] These samples need a new **API enabled** in testing projects to pass (let us know which ones) - [ ] These samples need a new/updated **env vars** in testing projects set to pass (let us know which ones) - [ ] Please **merge** this PR for me once it is approved. - [ ] This sample adds a new sample directory, and I updated the [CODEOWNERS file](https://github.com/GoogleCloudPlatform/python-docs-samples/blob/master/.github/CODEOWNERS) with the codeowners for this sample
1 parent 3a7737a commit da49e1f

File tree

9 files changed

+13
-4
lines changed

9 files changed

+13
-4
lines changed

run/django/Dockerfile

+2-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ ENV PYTHONUNBUFFERED 1
2424

2525
# Install dependencies
2626
COPY requirements.txt .
27-
RUN pip install --no-cache-dir -r requirements.txt
27+
RUN pip install --no-cache-dir -r requirements.txt
2828

2929
# Copy local code to the container image.
3030
COPY . .
@@ -33,4 +33,5 @@ COPY . .
3333
# webserver, with one worker process and 8 threads.
3434
# For environments with multiple CPU cores, increase the number of workers
3535
# to be equal to the cores available.
36+
# Timeout is set to 0 to disable the timeouts of the workers to allow Cloud Run to handle instance scaling.
3637
CMD exec gunicorn --bind 0.0.0.0:$PORT --workers 1 --threads 8 --timeout 0 mysite.wsgi:application

run/hello-broken/Dockerfile

+1
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ COPY . ./
3838
# Use gunicorn webserver with one worker process and 8 threads.
3939
# For environments with multiple CPU cores, increase the number of workers
4040
# to be equal to the cores available.
41+
# Timeout is set to 0 to disable the timeouts of the workers to allow Cloud Run to handle instance scaling.
4142
CMD exec gunicorn --bind :$PORT --workers 1 --threads 8 --timeout 0 main:app
4243

4344
# [END run_broken_dockerfile]

run/helloworld/Dockerfile

+1
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ RUN pip install Flask gunicorn
3434
# webserver, with one worker process and 8 threads.
3535
# For environments with multiple CPU cores, increase the number of workers
3636
# to be equal to the cores available.
37+
# Timeout is set to 0 to disable the timeouts of the workers to allow Cloud Run to handle instance scaling.
3738
CMD exec gunicorn --bind :$PORT --workers 1 --threads 8 --timeout 0 main:app
3839

3940
# [END run_helloworld_dockerfile]

run/image-processing/Dockerfile

+1
Original file line numberDiff line numberDiff line change
@@ -47,4 +47,5 @@ COPY . ./
4747
# Use gunicorn webserver with one worker process and 8 threads.
4848
# For environments with multiple CPU cores, increase the number of workers
4949
# to be equal to the cores available.
50+
# Timeout is set to 0 to disable the timeouts of the workers to allow Cloud Run to handle instance scaling.
5051
CMD exec gunicorn --bind :$PORT --workers 1 --threads 8 --timeout 0 main:app

run/logging-manual/Dockerfile

+2-1
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,9 @@ ENV APP_HOME /app
3131
WORKDIR $APP_HOME
3232
COPY . ./
3333

34-
# Run the web service on container startup.
34+
# Run the web service on container startup.
3535
# Use gunicorn webserver with one worker process and 8 threads.
3636
# For environments with multiple CPU cores, increase the number of workers
3737
# to be equal to the cores available.
38+
# Timeout is set to 0 to disable the timeouts of the workers to allow Cloud Run to handle instance scaling.
3839
CMD exec gunicorn --bind :$PORT --workers 1 --threads 8 --timeout 0 main:app

run/markdown-preview/editor/Dockerfile

+2-1
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,9 @@ ENV APP_HOME /app
3131
WORKDIR $APP_HOME
3232
COPY . ./
3333

34-
# Run the web service on container startup.
34+
# Run the web service on container startup.
3535
# Use gunicorn webserver with one worker process and 8 threads.
3636
# For environments with multiple CPU cores, increase the number of workers
3737
# to be equal to the cores available.
38+
# Timeout is set to 0 to disable the timeouts of the workers to allow Cloud Run to handle instance scaling.
3839
CMD exec gunicorn --bind :$PORT --workers 1 --threads 8 --timeout 0 main:app

run/markdown-preview/renderer/Dockerfile

+2-1
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,9 @@ ENV APP_HOME /app
3131
WORKDIR $APP_HOME
3232
COPY . ./
3333

34-
# Run the web service on container startup.
34+
# Run the web service on container startup.
3535
# Use gunicorn webserver with one worker process and 8 threads.
3636
# For environments with multiple CPU cores, increase the number of workers
3737
# to be equal to the cores available.
38+
# Timeout is set to 0 to disable the timeouts of the workers to allow Cloud Run to handle instance scaling.
3839
CMD exec gunicorn --bind :$PORT --workers 1 --threads 8 --timeout 0 main:app

run/pubsub/Dockerfile

+1
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ COPY . ./
3838
# Use gunicorn webserver with one worker process and 8 threads.
3939
# For environments with multiple CPU cores, increase the number of workers
4040
# to be equal to the cores available.
41+
# Timeout is set to 0 to disable the timeouts of the workers to allow Cloud Run to handle instance scaling.
4142
CMD exec gunicorn --bind :$PORT --workers 1 --threads 8 --timeout 0 main:app
4243

4344
# [END run_pubsub_dockerfile]

run/system-package/Dockerfile

+1
Original file line numberDiff line numberDiff line change
@@ -43,4 +43,5 @@ COPY . ./
4343
# Use gunicorn webserver with one worker process and 8 threads.
4444
# For environments with multiple CPU cores, increase the number of workers
4545
# to be equal to the cores available.
46+
# Timeout is set to 0 to disable the timeouts of the workers to allow Cloud Run to handle instance scaling.
4647
CMD exec gunicorn --bind :$PORT --workers 1 --threads 8 --timeout 0 main:app

0 commit comments

Comments
 (0)