0
votes

I have .env file for my docker-compose, and was able to run using "docker-compose up"

Now I pushed to cloud registry, and want to Cloud Run

How can I supply the various environemnt variables?

I did create secrets in secret manager, but how can I integrate both, so that my container starts reading all those needed secrets?

Note: My docker-compose is an app with database, but I can split them as 2 containers, if needed, but they still need secrets

Edit: Added secret references.enter image description here

EDIT:

I am unable to run my container

If env file X=x , and docker-compose environemnt app.prop=${X} then should I create secret X or x?

Is Cloud run using Dockerfile or docker-compose? I image pushed is built from docker-compose only. Sorry I am getting confused (not assuming trivial things as it is not working)

1
You can't use docker compose, and a stateful database in Cloud Run. The env var can't come from a file but need to be specified one by one or use a Knative YAML file to describe your deployment on Cloud Runguillaume blaquiere
So I have to create 2 containers, 1 db and 2 the app? how do they talk to each other?Kris Swat
Forget that. Your DB container is stateless. You will lost your data when the instance will be dropped. And ONLY API call, on the public URL and in HTTPS is allowed.guillaume blaquiere
Please can you tell - how can I have a mariadb for my application. I see link, but that is also a container - stateless? stackoverflow.com/questions/56601915/…Kris Swat
Use CLoud SQL service to host a MariaDB compliant database (MySQL)guillaume blaquiere

1 Answers

0
votes

It is not possible to use docker-compose on Cloud Run, as it is designed for individual stateless containers. My suggestion is to create an image from your application service, upload the image to Google Container Registry in order to use it for your Cloud Run service, and connect it to Cloud SQL following the attached documentation. You can store database credentials with Secret Manager and pass it to your Cloud Run service as environment variables (check this documentation).