Skip to content
This repository was archived by the owner on Oct 1, 2025. It is now read-only.

Commit 38f9e78

Browse files
committed
updates for Cloud Run stuff
Change-Id: I8005525ce4e755f2c39280e118752f2ef488a626
1 parent b4e523f commit 38f9e78

File tree

5 files changed

+8
-6
lines changed

5 files changed

+8
-6
lines changed

step4-cloudds-cloudrun-py3/README.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,8 @@ See Step 4a (see `step4a-cloudrun-bldpks-py3`) if interested in using Buildpacks
2929

3030
Learning how to use Cloud Run is not within the scope of this tutorial, so refer to the Quickstart above or the general [Cloud Run docs](https://cloud.google.com/run/docs). Containerizing your app for Cloud Run means no longer using App Engine. This means all App Engine configuration files will be replaced by Docker config files. You'll also have to tweak your code a bit to tell the container to launch the web server and start your app — these things were originally handled by App Engine automatically.
3131

32-
1. Delete `app.yaml` and `appengine_config.py` config files as they're not used with Cloud Run.
33-
1. Delete the `lib` folder for the same reason.
32+
1. Delete the `app.yaml` as it's not used with Cloud Run.
33+
1. If you just migrated to Python 3, you may have some Python 2 leftovers like `appengine_config.py` & a `lib` folder; delete those too.
3434
1. Add a `Dockerfile` with the container specifications and optionally a `.dockerignore` file as well.
3535
1. The `requirements.txt` and `templates/index.html` are fine to leave as-is.
3636
1. Modify `main.py` to start up the Flask app.
@@ -66,6 +66,7 @@ Cloud Run starts its web server on port 8080, automatically injected into the `P
6666

6767
```python
6868
if __name__ == '__main__':
69+
import os
6970
app.run(debug=True, threaded=True, host='0.0.0.0',
7071
port=int(os.environ.get('PORT', 8080)))
7172
```

step4-cloudndb-cloudrun-py2/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,7 @@ Cloud Run starts its web server on port 8080, automatically injected into the `P
6666

6767
```python
6868
if __name__ == '__main__':
69+
import os
6970
app.run(debug=True, threaded=True, host='0.0.0.0',
7071
port=int(os.environ.get('PORT', 8080)))
7172
```

step4-cloudndb-cloudrun-py2/main.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
1414

15-
import os
1615
from flask import Flask, render_template, request
1716
from google.cloud import ndb
1817

@@ -39,5 +38,6 @@ def root():
3938
return render_template('index.html', visits=visits)
4039

4140
if __name__ == '__main__':
41+
import os
4242
app.run(debug=True, threaded=True, host='0.0.0.0',
4343
port=int(os.environ.get('PORT', 8080)))

step4a-cloudrun-bldpks-py3/main.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313
# limitations under the License.
1414

1515
from datetime import datetime
16-
import os
1716
from flask import Flask, render_template, request
1817
from google.cloud import datastore
1918

@@ -40,5 +39,6 @@ def root():
4039
return render_template('index.html', visits=visits)
4140

4241
if __name__ == '__main__':
42+
import os
4343
app.run(debug=True, threaded=True, host='0.0.0.0',
4444
port=int(os.environ.get('PORT', 8080)))

step4a-cloudrun-bldpks-py3/service.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,5 +25,5 @@ spec:
2525
annotations: {}
2626
spec:
2727
containers:
28-
- image: gcr.io/wescpy-gae3/image
29-
serviceAccountName: docker-client1@wescpy-gae3.iam.gserviceaccount.com
28+
- image: gcr.io/PROJECT_ID/image
29+
serviceAccountName: docker-client1@PROJECT_ID.iam.gserviceaccount.com

0 commit comments

Comments
 (0)