Skip to content

Commit f2ae40c

Browse files
committed
Fix static assets root for container runtime
1 parent c8a648a commit f2ae40c

3 files changed

Lines changed: 7 additions & 22 deletions

File tree

GitProtect/Components/App.razor

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
<base href="/" />
88
<ResourcePreloader />
99
<link rel="stylesheet" href="@Assets["app.css"]" />
10-
<link rel="stylesheet" href="@Assets["GitProtect.styles.css"]" />
1110
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.5.1/css/all.min.css" />
1211
<ImportMap />
1312
<link rel="icon" type="image/png" href="favicon.png" />

GitProtect/Program.cs

Lines changed: 6 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,12 @@
66
using GitProtect.Services;
77
using Microsoft.EntityFrameworkCore;
88

9-
var builder = WebApplication.CreateBuilder(args);
9+
var builder = WebApplication.CreateBuilder(new WebApplicationOptions
10+
{
11+
Args = args,
12+
ContentRootPath = AppContext.BaseDirectory
13+
});
14+
builder.WebHost.UseWebRoot(Path.Combine(AppContext.BaseDirectory, "wwwroot"));
1015

1116
// Allow Docker-prefixed env vars (GITPROTECT__*) to override appsettings.
1217
builder.Configuration.AddEnvironmentVariables("GITPROTECT__");
@@ -38,25 +43,6 @@
3843

3944
var app = builder.Build();
4045

41-
app.Use((context, next) =>
42-
{
43-
var path = context.Request.Path.Value;
44-
if (!string.IsNullOrEmpty(path)
45-
&& (path.StartsWith("http://", StringComparison.OrdinalIgnoreCase)
46-
|| path.StartsWith("https://", StringComparison.OrdinalIgnoreCase)))
47-
{
48-
if (Uri.TryCreate(path, UriKind.Absolute, out var uri))
49-
{
50-
context.Request.Path = uri.AbsolutePath;
51-
context.Request.QueryString = string.IsNullOrEmpty(uri.Query)
52-
? QueryString.Empty
53-
: new QueryString(uri.Query);
54-
}
55-
}
56-
57-
return next();
58-
});
59-
6046
if (app.Environment.IsDevelopment())
6147
{
6248
app.UseWebAssemblyDebugging();

entrypoint.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,4 +40,4 @@ chown -R "${PUID}:${PGID}" /app /data
4040
chmod 755 /app
4141
chmod 775 /data
4242

43-
exec su -s /bin/sh -c "cd /app && dotnet GitProtect.dll" "${APP_USER}"
43+
exec su -s /bin/sh -c "dotnet /app/GitProtect.dll" "${APP_USER}"

0 commit comments

Comments
 (0)