1. Answers
  2. Deploy The Jfrog/artifactory-oss:latest Docker Image On Google CloudRun With TypeScript.

Deploy the Jfrog/Artifactory-Oss:latest Docker Image on Google CloudRun With TypeScript.

This Pulumi program will deploy the jfrog/artifactory-oss:latest Docker image on Google CloudRun using TypeScript. The program will create a Google CloudRun service, configure it to use the specified Docker image, and set the necessary permissions and environment variables.

Step-by-Step Explanation

  1. Set up your Pulumi project: Ensure you have a Pulumi project set up with TypeScript as the language. If not, you can create one using pulumi new typescript.
  2. Install Pulumi GCP provider: Run npm install @pulumi/gcp to install the Pulumi GCP provider.
  3. Create a Google CloudRun service:
    • Import the required modules from Pulumi and the GCP provider.
    • Define the CloudRun service, specifying the Docker image jfrog/artifactory-oss:latest.
    • Set the necessary permissions and environment variables for the service.
  4. Deploy the service: Use pulumi up to deploy the CloudRun service.

Summary

This Pulumi program demonstrates how to deploy the jfrog/artifactory-oss:latest Docker image on Google CloudRun using TypeScript. By following the steps, you will create a CloudRun service, configure it with the specified Docker image, and deploy it using Pulumi.

Full Code Example

import * as pulumi from "@pulumi/pulumi";
import * as gcp from "@pulumi/gcp";

// Define the CloudRun service
const service = new gcp.cloudrun.Service("artifactory-service", {
    location: "us-central1",
    template: {
        spec: {
            containers: [{
                image: "jfrog/artifactory-oss:latest",
                envs: [
                    { name: "ARTIFACTORY_HOME", value: "/var/opt/jfrog/artifactory" },
                    { name: "JAVA_OPTIONS", value: "-Xms512m -Xmx2g" }
                ],
            }],
        },
    },
    traffics: [{
        latestRevision: true,
        percent: 100,
    }],
});

// Set IAM policy to allow public access
const iamMember = new gcp.cloudrun.IamMember("artifactory-iam-member", {
    location: service.location,
    project: service.project,
    service: service.name,
    role: "roles/run.invoker",
    member: "allUsers",
});

// Export the URL of the service
export const serviceUrl = service.statuses[0].url;

Deploy this code

Want to deploy this code? Sign up for a free Pulumi account to deploy in a few clicks.

Sign up

New to Pulumi?

Want to deploy this code? Sign up with Pulumi to deploy in a few clicks.

Sign up