Deploying to App Engine Flexible Environment

You can use the App Engine Flexible Environment to customize an existing runtime (such as Java 8), or to provide your own runtime by supplying a custom Docker image or Dockerfile.

With Cloud Build, you can automate building your containers, pushing them to Artifact Registry, and deploying them to App Engine.

Required permissions

By default, the App Engine default service account has permissions to pull from and push to repositories in the same project.

If App Engine is in a different project, you must grant the App Engine service account with permissions to access your Artifact Registry repository.

Deploying to App Engine

You can deploy an image hosted by Artifact Registry to App Engine using the gcloud command-line tool.

  1. Create the App Engine configuration file for your app.
  2. Build a Docker image and push it to your repository. You can use Cloud Build to build and push your container to the repository.
  3. Deploy your image to App Engine by running the following command:

    gcloud app deploy --image-url=LOCATION-docker.pkg.dev/PROJECT-ID/REPOSITORY/IMAGE:TAG
    

    where:

    • LOCATION is the regional or multi-regional location of the repository.
    • PROJECT is ID of the project that contains the repository. If your project ID contains a colon (:), see Domain-scoped projects.
    • REPOSITORY is the name of the repository where the image is stored.
    • IMAGE is the name of the image in the repository.
    • TAG is the tag of the image version that you want to pull.

    For example:

    gcloud app deploy --image-url=us-central1-docker.pkg.dev/my-project/my-repo/my-image:1.0