Skip to content

Commit ec9cb5f

Browse files
jama22akerekes
andauthored
Update README.md (#207)
* Update README.md * Update README.md fixed typo --------- Co-authored-by: Andras Kerekes <akerekes@users.noreply.github.com>
1 parent 4838130 commit ec9cb5f

File tree

1 file changed

+4
-91
lines changed

1 file changed

+4
-91
lines changed

README.md

Lines changed: 4 additions & 91 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ The Functions Framework lets you write lightweight functions that run in many
99
different environments, including:
1010

1111
* Your local development machine
12-
* [Cloud Run and Cloud Run on GKE](https://cloud.google.com/run/)
1312
* [Knative](https://github.com/knative/)-based environments
1413

1514
The framework allows you to go from:
@@ -110,102 +109,16 @@ curl localhost:8080
110109
# Output: Hello World from a PHP HTTP function!
111110
```
112111

113-
## Run your function on Google Cloud Functions
112+
## Run your function on Google Cloud Run Functions
114113

115114
**NOTE**: For an extensive list of samples, see the [PHP functions samples][functions-samples]
116115
and the [official how-to guides][functions-how-to].
117116

118-
Follow the steps below to deploy to Google Cloud Functions. More information
119-
on function deployment is available in the
120-
[GCF documentation](https://cloud.google.com/functions/docs/deploying).
117+
Follow the [Cloud Run function quickstart](https://cloud.google.com/run/docs/quickstarts/functions/deploy-functions-gcloud#php) for PHP to learn how to deploy a function to Cloud Run.
121118

122-
To run your function on Cloud Functions, first you must have the [gcloud SDK][gcloud] installed and [authenticated][gcloud-auth].
119+
## Run your function as a container in Cloud Run
123120

124-
Make sure your source file (which defines your function) is called
125-
`index.php`. The Functions Framework lets you choose a function source file,
126-
but Cloud Functions currently uses the default of `index.php`.
127-
128-
Decide _which_ function in the source file to invoke, that is, the name that you
129-
used when writing the function. This is called the **target**.
130-
131-
Choose a Cloud Functions **name** for your function. The **name** identifies
132-
this function deployment (e.g. in the cloud console) and is also part of the
133-
function's default URL. (Note: the **name** and the **target** do not have to
134-
be the same value.)
135-
136-
Then, from the directory containing your function source, issue the gcloud command to deploy:
137-
138-
```sh
139-
gcloud functions deploy $YOUR_FUNCTION_NAME \
140-
--runtime=php74 \
141-
--entry-point=$YOUR_FUNCTION_TARGET \
142-
--trigger-http
143-
```
144-
145-
The `--entry-point` flag can be omitted if the **target** has the same value
146-
as the **name**.
147-
148-
If your function handles events rather than HTTP requests, you'll need to
149-
replace `--trigger-http` with a different trigger. For details, see the
150-
[reference documentation](https://cloud.google.com/sdk/gcloud/reference/functions/deploy)
151-
for `gcloud functions deploy`.
152-
153-
To update your deployment, just redeploy using the same function **name**.
154-
Configuration flags are not required.
155-
156-
## Run your function in Cloud Run
157-
158-
To run your function in Cloud Run, first you must have the [gcloud SDK][gcloud] installed and [authenticated][gcloud-auth].
159-
160-
Additionally, you need to have a Google Cloud project ID for the
161-
[Google Cloud Project][gcp-project] you want to use.
162-
163-
After completing the steps under **Installation** and **Define your Function**, build the container using the example `Dockerfile`. This Dockerfile is
164-
built on top of the [App Engine runtime for PHP 7.4][gae-php7], but you can use
165-
any container you want as long as your application listens on **Port 8080**.
166-
167-
```sh
168-
docker build . \
169-
-f vendor/google/cloud-functions-framework/examples/hello/Dockerfile \
170-
-t gcr.io/$GCLOUD_PROJECT/my-cloud-function
171-
```
172-
173-
> **NOTE**: Be sure to replace `$GCLOUD_PROJECT` with your Google Cloud project
174-
ID, or set the environment variable using `export GCLOUD_PROJECT="some-project-id"`.
175-
176-
Next, push your image to [Google Container Registry](https://cloud.google.com/container-registry). This will allow you to deploy it directly from Cloud Run.
177-
178-
```sh
179-
docker push gcr.io/$GCLOUD_PROJECT/my-cloud-function
180-
```
181-
182-
Finally, use the `gcloud` command-line tool to deploy to Cloud Run:
183-
184-
```sh
185-
gcloud run deploy my-cloud-function \
186-
--image=gcr.io/$GCLOUD_PROJECT/my-cloud-function \
187-
--platform managed \
188-
--set-env-vars "FUNCTION_TARGET=helloHttp" \
189-
--allow-unauthenticated \
190-
--region $CLOUD_RUN_REGION \
191-
--project $GCLOUD_PROJECT
192-
```
193-
194-
> **NOTE**: Be sure to replace `$CLOUD_RUN_REGION` with the
195-
[correct region][cloud-run-regions] for your Cloud Run instance, for example
196-
`us-central1`.
197-
198-
After your instance deploys, you can access it at the URL provided, or view it
199-
in the [Cloud Console][cloud-run-console].
200-
201-
[functions-samples]: https://github.com/GoogleCloudPlatform/php-docs-samples/tree/main/functions
202-
[functions-how-to]: https://cloud.google.com/functions/docs/how-to
203-
[gcloud]: https://cloud.google.com/sdk/gcloud/
204-
[gcloud-auth]: https://cloud.google.com/sdk/docs/authorizing
205-
[gcp-project]: https://cloud.google.com/resource-manager/docs/creating-managing-projects
206-
[gae-php7]: https://cloud.google.com/appengine/docs/standard/php7/runtime
207-
[cloud-run-regions]: https://cloud.google.com/run/docs/locations
208-
[cloud-run-console]: https://console.cloud.google.com/run
121+
You can manually build your function as a container and deploy it into Cloud Run. Follow the [Cloud Run instructions for building a function](https://cloud.google.com/run/docs/building/functions) for complete instructions.
209122

210123
## Use CloudEvents
211124

0 commit comments

Comments
 (0)