Skip to content
This repository was archived by the owner on Jan 12, 2022. It is now read-only.

Commit 5b989c9

Browse files
author
Jon Wayne Parrott
committed
Merge pull request #86 from GoogleCloudPlatform/develop-app
Adding develop app
2 parents 261910e + ca17f02 commit 5b989c9

10 files changed

Lines changed: 75 additions & 5 deletions

File tree

.dockerignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,5 @@ env
44
__pycache__
55
.cache
66
tests
7+
develop
8+
.tox

DEVELOPING.md

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -48,8 +48,4 @@ This will build the base image and then deploy the application. Once it's done d
4848

4949
## Developing
5050

51-
When developing, it's best to use the `tests-e2e` app as a guide:
52-
53-
* Build a custom version of the base image.
54-
* Write an app with a custom dockerfile that extends from your custom base image.
55-
* Deploy the app.
51+
When developing, refer to the developing app under [`/develop`](develop).

develop/.dockerignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
*.pyc
2+
__pycache__
3+
.cache

develop/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Dockerfile

develop/Dockerfile.in

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
FROM $DOCKER_IMAGE_NAME
2+
3+
ADD . /app/
4+
RUN pip install -r /app/requirements.txt

develop/Makefile

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
include ../common.mk
2+
3+
.PHONY: all
4+
all: deploy
5+
6+
.PHONY: deploy
7+
deploy: build-base generate-dockerfile
8+
gcloud preview app deploy -q
9+
10+
.PHONY: build-base
11+
build-base:
12+
$(MAKE) -C .. push
13+
14+
.PHONY: generate-dockerfile
15+
generate-dockerfile:
16+
sed "s#\$$DOCKER_IMAGE_NAME#$(DOCKER_IMAGE_NAME)#g" Dockerfile.in > Dockerfile

develop/README.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
# Development App
2+
3+
This is a barebones app to use when developing changes to the core runtime components, such as the base docker image and vmruntime library.
4+
5+
This works by:
6+
7+
1. Building a custom version of the base image and pushing it to gcr.io.
8+
2. Building the app's image using the custom base image.
9+
10+
This allows you to replicate the end-to-end image building process while developing. The end-to-end test app uses the same build method.
11+
12+
## Usage
13+
14+
Just use `make all`.

develop/app.yaml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
runtime: custom
2+
vm: true
3+
4+
handlers:
5+
- url: .*
6+
script: main.app
7+
8+
manual_scaling:
9+
instances: 1

develop/main.py

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
# Copyright 2016 Google Inc. All Rights Reserved.
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
15+
import webapp2
16+
17+
18+
class IndexHandler(webapp2.RequestHandler):
19+
def get(self):
20+
self.response.out.write('Index.')
21+
22+
23+
app = webapp2.WSGIApplication([
24+
('/', IndexHandler),
25+
], debug=True)

develop/requirements.txt

Whitespace-only changes.

0 commit comments

Comments
 (0)