How do I deploy the SonarQube:latest Docker image on Google CloudRun with TypeScript?
In this guide, we will deploy the sonarqube:latest
Docker image on Google CloudRun using Pulumi and TypeScript. Google CloudRun is a fully managed compute platform that automatically scales your stateless containers. We will define the necessary resources including the CloudRun service and deploy the SonarQube container image.
import * as pulumi from "@pulumi/pulumi";
import * as gcp from "@pulumi/gcp";
// Define the configuration for the CloudRun service
const service = new gcp.cloudrun.Service("sonarqube-service", {
location: "us-central1",
template: {
spec: {
containers: [{
image: "sonarqube:latest",
ports: [{ containerPort: 9000 }],
}],
},
},
});
// Allow unauthenticated invocations to the service
const iam = new gcp.cloudrun.IamMember("service-iam", {
service: service.name,
location: service.location,
role: "roles/run.invoker",
member: "allUsers",
});
// Export the URL of the deployed service
export const serviceUrl = service.statuses[0].url;
Key Points
- Google CloudRun Service: We created a CloudRun service that specifies the
sonarqube:latest
Docker image. - IAM Policy: We configured the IAM policy to allow unauthenticated invocations to the service.
- Service URL: We exported the URL of the deployed CloudRun service to access SonarQube.
Summary
We successfully deployed the sonarqube:latest
Docker image on Google CloudRun using Pulumi and TypeScript. This setup allows you to run SonarQube in a serverless environment with automatic scaling and managed infrastructure. The service is accessible via the exported URL.
Deploy this code
Want to deploy this code? Sign up for a free Pulumi account to deploy in a few clicks.
Sign upNew to Pulumi?
Want to deploy this code? Sign up with Pulumi to deploy in a few clicks.
Sign upThank you for your feedback!
If you have a question about how to use Pulumi, reach out in Community Slack.
Open an issue on GitHub to report a problem or suggest an improvement.