From 635b5ea646ec55c7ae212f79031b69c00ad79763 Mon Sep 17 00:00:00 2001 From: crupest Date: Sun, 31 May 2020 15:35:25 +0800 Subject: Migrate to docker. --- Timeline/Dockerfile | 4 ++++ Timeline/Services/PathProvider.cs | 2 +- Timeline/Startup.cs | 6 ------ Timeline/appsettings.json | 5 ++--- 4 files changed, 7 insertions(+), 10 deletions(-) create mode 100644 Timeline/Dockerfile (limited to 'Timeline') diff --git a/Timeline/Dockerfile b/Timeline/Dockerfile new file mode 100644 index 00000000..68685a55 --- /dev/null +++ b/Timeline/Dockerfile @@ -0,0 +1,4 @@ +FROM mcr.microsoft.com/dotnet/core/aspnet:3.1 +WORKDIR /app +COPY ./publish . +ENTRYPOINT ["dotnet", "Timeline.dll"] diff --git a/Timeline/Services/PathProvider.cs b/Timeline/Services/PathProvider.cs index 1f6b629a..eefbf41a 100644 --- a/Timeline/Services/PathProvider.cs +++ b/Timeline/Services/PathProvider.cs @@ -21,7 +21,7 @@ namespace Timeline.Services public PathProvider(IConfiguration configuration) { _configuration = configuration; - _workingDirectory = configuration.GetValue("WorkDir"); + _workingDirectory = configuration.GetValue("WorkDir") ?? "/timeline"; } public string GetWorkingDirectory() diff --git a/Timeline/Startup.cs b/Timeline/Startup.cs index b6c3ff7f..09281551 100644 --- a/Timeline/Startup.cs +++ b/Timeline/Startup.cs @@ -36,12 +36,6 @@ namespace Timeline // This method gets called by the runtime. Use this method to add services to the container. public void ConfigureServices(IServiceCollection services) { - var workDir = Configuration.GetValue("WorkDir"); - if (workDir == null) - { - throw new InvalidOperationException("Please set a work directory first."); - } - services.AddControllers(setup => { setup.InputFormatters.Add(new StringInputFormatter()); diff --git a/Timeline/appsettings.json b/Timeline/appsettings.json index 09840cd6..804ca43a 100644 --- a/Timeline/appsettings.json +++ b/Timeline/appsettings.json @@ -6,7 +6,6 @@ }, "Jwt": { "Issuer": "api.crupest.xyz", - "Audience": "api.crupest.xyz", - }, - "Cors": [ "https://www.crupest.xyz", "https://crupest.xyz" ] + "Audience": "api.crupest.xyz" + } } -- cgit v1.2.3