gcloud alpha code dev

gcloud alpha code dev - run a Cloud Run service in a local development environment
gcloud alpha code dev [--cloudsql-instances=[CLOUDSQL_INSTANCE,…]] [--cpu=CPU] [--image=IMAGE] [--local-port=LOCAL_PORT] [--memory=MEMORY] [--minikube-vm-driver=MINIKUBE_VM_DRIVER; default="docker"] [--namespace=NAMESPACE] [--service-name=SERVICE_NAME] [--source=SOURCE] [--no-stop-cluster] [--appengine     | --builder=BUILDER     | --dockerfile=DOCKERFILE; default="Dockerfile"] [--application-default-credential     | --service-account=SERVICE_ACCOUNT] [--env-vars=[KEY=VALUE,…]     | --env-vars-file=FILE_PATH] [--kube-context=KUBE_CONTEXT     | --minikube-profile=MINIKUBE_PROFILE] [GCLOUD_WIDE_FLAG]
(ALPHA) This command takes Cloud Run source, builds it, and runs it on the local machine. This command also watches the relevant source files and updates the container when they change. If building images using a Dockerfile:
gcloud alpha code dev --dockerfile=<path_to_dockerfile>

If the Dockerfile is named Dockerfile and is located in the current directory, the --dockerfile flag may be omitted:

gcloud alpha code dev

If building images with a CNCF buildpack builder:

gcloud alpha code dev --builder=<builder>

To access Google Cloud Platform services with the current user's credentials, login to obtain the application default credentials and invoke this command with the --application-default-credential flag.

gcloud auth application-default login
gcloud alpha code dev --dockerfile=<path_to_dockerfile>  --application-default-credential
Cloud SQL instance connection strings. Must be in the form <project>:<region>:<instance>.
Container CPU limit. Limit is expressed as a number of CPUs. Fractional CPU limits are allowed (e.g. 1.5).
Name for the built image.
Local port to which the service connection is forwarded. If this flag is not set, then a random port is chosen.
Container memory limit. Limit is expressed either as an integer representing the number of bytes or an integer followed by a unit suffix. Valid unit suffixes are "B", "KB", "MB", "GB", "TB", "KiB", "MiB", "GiB", "TiB", or "PiB".
--minikube-vm-driver=MINIKUBE_VM_DRIVER; default="docker"
If running on minikube, use this vm driver.
Kubernetes namespace for development kubernetes objects.
Name of the service.
The directory containing the source to build. If not specified, the current directory is used.
If running on minikube, stop the minkube profile at the end of the session. Enabled by default, use --no-stop-cluster to disable.
At most one of these may be specified:
Build with a Cloud Native Computing Foundation Buildpack builder selected from gcr.io/gae-runtimes/buildpacks, according to the App Engine runtime specified in app.yaml.
Build with a given Cloud Native Computing Foundation Buildpack builder.
--dockerfile=DOCKERFILE; default="Dockerfile"
Dockerfile for the service image.
At most one of these may be specified:
When connecting to Google Cloud Platform services, use the application default credential.
When connecting to Google Cloud Platform services, use a service account key.
At most one of these may be specified:
List of key-value pairs to set as environment variables.
Path to a local YAML file with definitions for all environment variables.
At most one of these may be specified:
Kubernetes context.
Minikube profile.
These flags are available to all commands: --account, --billing-project, --configuration, --flags-file, --flatten, --format, --help, --impersonate-service-account, --log-http, --project, --quiet, --trace-token, --user-output-enabled, --verbosity.

Run $ gcloud help for details.

This command is currently in ALPHA and may change without notice. If this command fails with API permission errors despite specifying the right project, you may be trying to access an API with an invitation-only early access allowlist.