Deploy Docker images to google cloud run with docker-compose

I’m trying to deploy an app from a docker-compose file with two images in it: an Angular app (frontend) and a very small nestjs app (backend). I’m using GCB, their triggers and a cloudbuild.json.

This is its current state:

{
  "steps": [
    {
      "name": "gcr.io/$PROJECT_ID/docker-compose",
      "args": ["-f", "./docker-compose.${_ENVIRONMENT}.yml", "up", "-d"]
    },
    {
      "name": "gcr.io/cloud-builders/docker",
      "args": ["tag", "configurator:latest", "gcr.io/$PROJECT_ID/${_IMAGE_ID}"]
    },
    {
      "name": "gcr.io/cloud-builders/gcloud",
      "args": [
        "run", "deploy",
        "--allow-unauthenticated",
        "${_IMAGE_ID}",
        "--image", "gcr.io/$PROJECT_ID/${_IMAGE_ID}",
        "--region", "europe-west4",
        "--platform", "managed"
      ]
    }
  ],
  "images": [
    "gcr.io/$PROJECT_ID/${_IMAGE_ID}"
  ],
  "timeout": "1200s"
}

The build always fails on step 2, when trying to push the docker image to the registry. I’m not really sure what the images name could be or how this should even work, since there is two docker images that need to be pushed and deployed. Is it even possible with GCB or do I need a GKE Cluster for running two docker images?

Should I maybe build the two Docker images separately, push them each to the registry and deploy them to separate GCR Services?

Thanks in advance.

Source: Docker Questions

LEAVE A COMMENT