Set up docker image and k8s deployment
This commit is contained in:
@@ -17,6 +17,9 @@
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<None Update="appsettings.Docker.json">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Update="appsettings.Development.json">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</None>
|
||||
|
||||
@@ -2,12 +2,14 @@
|
||||
using System;
|
||||
|
||||
public class ServiceOptions {
|
||||
public string Baserom { get; set; } = null!;
|
||||
public string PythonPath { get; set; } = null!;
|
||||
public string RandomizerPath { get; set; } = null!;
|
||||
public AzureSettings AzureSettings { get; set; } = new AzureSettings();
|
||||
}
|
||||
|
||||
public class AzureSettings {
|
||||
public string? ClientId { get; set; }
|
||||
public Uri BlobstoreEndpoint { get; set; } = null!;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
using ALttPRandomizer.Azure;
|
||||
using ALttPRandomizer.Options;
|
||||
using ALttPRandomizer.Service;
|
||||
using global::Azure.Core;
|
||||
using global::Azure.Identity;
|
||||
using global::Azure.Storage.Blobs;
|
||||
using Microsoft.AspNetCore.Builder;
|
||||
@@ -20,7 +21,7 @@
|
||||
|
||||
builder.Configuration
|
||||
.AddJsonFile("appsettings.json")
|
||||
.AddJsonFile("appsettings.Development.json")
|
||||
.AddJsonFile("appsettings.Development.json", true)
|
||||
.AddEnvironmentVariables();
|
||||
|
||||
builder.Services.Configure<ServiceOptions>(builder.Configuration.GetSection("ALttPRandomizer"));
|
||||
@@ -34,7 +35,13 @@
|
||||
var provider = builder.Services.BuildServiceProvider();
|
||||
var settings = provider.GetRequiredService<IOptionsMonitor<ServiceOptions>>().CurrentValue!;
|
||||
|
||||
var token = new DefaultAzureCredential();
|
||||
var options = new DefaultAzureCredentialOptions();
|
||||
|
||||
if (settings.AzureSettings.ClientId != null) {
|
||||
options.ManagedIdentityClientId = new(settings.AzureSettings.ClientId);
|
||||
}
|
||||
|
||||
var token = new DefaultAzureCredential(options);
|
||||
var seedClient = new BlobContainerClient(settings.AzureSettings.BlobstoreEndpoint, token);
|
||||
|
||||
builder.Services.AddSingleton(seedClient);
|
||||
|
||||
@@ -37,7 +37,8 @@
|
||||
|
||||
var args = start.ArgumentList;
|
||||
args.Add("DungeonRandomizer.py");
|
||||
args.Add("--rom=../alttp.sfc");
|
||||
args.Add("--rom");
|
||||
args.Add(this.Configuration.Baserom);
|
||||
args.Add("--bps");
|
||||
|
||||
args.Add("--outputpath");
|
||||
|
||||
16
ALttPRandomizer/appsettings.Docker.json
Normal file
16
ALttPRandomizer/appsettings.Docker.json
Normal file
@@ -0,0 +1,16 @@
|
||||
{
|
||||
"ALttPRandomizer": {
|
||||
"baserom": "/randomizer/alttp.sfc",
|
||||
"pythonPath": "/usr/bin/python3",
|
||||
"randomizerPath": "/randomizer",
|
||||
"azureSettings": {
|
||||
"clientId": "2f242de5-7595-432c-b41d-30d21b2064f2",
|
||||
"blobstoreEndpoint": "https://alttprstorage.blob.core.windows.net/seeds"
|
||||
}
|
||||
},
|
||||
"Logging": {
|
||||
"LogLevel": {
|
||||
"Default": "Information"
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user