sparse-intern-71089
05/24/2022, 5:27 PMorange-policeman-59119
05/24/2022, 6:45 PMorange-policeman-59119
05/24/2022, 6:46 PMI know on the UI you can configure a container right there when making your instanceAre you talking about a Compute Engine VM?
proud-nail-99860
05/24/2022, 6:49 PMproud-nail-99860
05/24/2022, 6:49 PMproud-nail-99860
05/24/2022, 6:49 PM// Build the run command.
let runCommand = pulumi.all([cfg.requireSecret("account_private_key"), cfg.requireSecret("spotify_client_id"), cfg.requireSecret("spotify_client_secret")]).apply(([account_private_key, spotify_client_id, spotify_client_secret]) => [
"docker",
"run",
"--pull", "always",
"-v", "/tmp:/hostcache",
"<http://ghcr.io/banool/aptos-infinite-jukebox-driver:main|ghcr.io/banool/aptos-infinite-jukebox-driver:main>",
"--account-private-key", account_private_key,
"--spotify-client-id", spotify_client_id,
"--spotify-client-secret", spotify_client_secret,
"--cache-path", "/hostcache/cache.json",
].join(" "));
// Create a Compute Engine instance.
const driverInstance = new gcp.compute.Instance("driver-instance", {
machineType: "f1-micro",
zone: ${region}-c,
bootDisk: {
initializeParams: {
// I used <https://console.cloud.google.com/compute/images> to find the
// family and name to use here. This is the Container Optimized OS.
image: "projects/cos-cloud/global/images/cos-stable-97-16919-29-21",
},
},
allowStoppingForUpdate: true,
deletionProtection: false,
networkInterfaces: [{
network: "default",
accessConfigs: [{}],
}],
metadataStartupScript: runCommand
});
export const driverInstanceId = driverInstance.id;
quaint-twilight-92541
03/03/2023, 2:15 AMquaint-twilight-92541
03/07/2023, 11:21 PMdockerImage := fmt.Sprintf("%s-docker.pkg.dev/%s/example/image:latest", region, project)
spec := map[interface{}]interface{}{
"spec": map[interface{}]interface{}{
"containers": []interface{}{
map[interface{}]interface{}{
"env": []interface{}{
map[interface{}]interface{}{
"name": "ENV_VAR",
"value": value_str,
},
},
"image": dockerImage,
},
},
"volumes": []string{},
"restartPolicy": "OnFailure",
},
}
specYAML, err := yaml.Marshal(spec)
if err != nil {
return
}
metadata := map[string]string{
"gce-container-declaration": string(specYAML),
"google-logging-enabled": "true",
"google-monitoring-enabled": "true",
}
return compute.NewInstance(ctx, "example", &compute.InstanceArgs{
...
BootDisk: &compute.InstanceBootDiskArgs{
InitializeParams: &compute.InstanceBootDiskInitializeParamsArgs{
Image: pulumi.String("projects/cos-cloud/global/images/family/cos-stable"),
},
},
Metadata: pulumi.ToStringMap(metadata),
...
})
quaint-twilight-92541
03/07/2023, 11:23 PM