gcp - DeboraEngelmann/helloworld_from_jason GitHub Wiki
Configuring GCP project and uploading application
To install the SDK, add the URI of the Cloud SDK distribution as a package source.
echo "deb [signed-by=/usr/share/keyrings/cloud.google.gpg] http://packages.cloud.google.com/apt cloud-sdk main" | sudo tee -a /etc/apt/sources.list.d/google-cloud-sdk.list
Import the Google Cloud Platform public key.
curl https://packages.cloud.google.com/apt/doc/apt-key.gpg | sudo apt-key --keyring /usr/share/keyrings/cloud.google.gpg add -
Update the package list and install the Cloud SDK.
sudo apt-get update && sudo apt-get install google-cloud-sdk
To start the SDK, run the following command.
gcloud init
Follow the instructions to select an already created project or create a new project.
To configure Docker to use GCloud, run the following command.
gcloud auth configure-docker
The command below is used to add a tag to the image we just created and define the URL where we will send it to.
docker tag chatbot-integration gcr.io/<YourProjectId>/chatbot-integration
To upload the image to the GCP use the following command.
docker push gcr.io/<YourProjectId>/chatbot-integration
Access https://console.cloud.google.com/ (make sure the project is selected correctly). In the side menu select the option Container Registry
.
The container we just loaded will be listed.
Now, it will be necessary to initialize the image that we have just created in a new container. To do this, access the menu Cloud Run
.
Click on Create Service
.
Name the service, check the option Allow unauthenticated invocations
, and click Next
.
click in Select
and look for the image we upload.
Click on Show advanced settings
and change the amount of Allocated memory
to 512MB and click Create
.
On the next screen, when the flag indicating the status is green, the URL will also be available to be copied.
You can use the URL address to test with Postman in the same way as before.