Concrete example of Deno Run on Cloud Run. Could be used as boilerplate for Deno in Docker / on Google Cloud Run.
First, make sure you have Deno installed
Then, to locally run, execute:
deno run --allow-env --allow-net main.ts
This will build and run the demo.
To run in docker, first build the app:
docker build -t denotest .
then run the container:
docker run -it --init -p 8080:8080 denotest
The dockerfile will pre-cache all dependencies.
Because the whole thing runs in Docker, this is easy (make sure you are logged in and have the right project on GCP selected with gcloud
):
This is optional, but nice to have:
GCP_PROJECT=$(gcloud config list --format 'value(core.project)')
gcloud builds submit --tag gcr.io/$GCP_PROJECT/denotest
gcloud run deploy denotest --image gcr.io/$GCP_PROJECT/denotest --platform managed --allow-unauthenticated