Reputation: 1292
I am looking at what Cloud Run suggests for local testing here, which is to docker run
your
container, and then run your tests against it on localhost:8080. Something like this:
PORT=8080 && \
docker run -d -p 8080:${PORT} -e PORT=${PORT} gcr.io/myproject/myimage && \
./runtests.sh
Now let's say I want to run these tests as part of a Cloud Build. Is it possible/advisable to run docker run
as a Cloud Build step? I don't see any gcr.io image for docker itself, so I'm guessing not?
Or does it need to be actually deployed to Cloud Run first, then tested?
Upvotes: 2
Views: 1933
Reputation: 2673
According to the documentation, you should be able to do so. You can create custom steps and there is one image for docker: gcr.io/cloud-builders/docker
. There's more information about creating custom steps in the cloudbuild.yaml
in the public documentation.
Something similar to this should work for you:
steps:
- name: 'gcr.io/cloud-builders/docker'
args: [ 'run', '-d', '-p', '8080:8080', '-e', 'PORT=8080', 'gcr.io/myproject/myimage' , './runtests.sh']
Upvotes: 1