-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Updated docker configuration to include publishing the app for easier…
… hosting.
- Loading branch information
Showing
8 changed files
with
77 additions
and
52 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
FROM mcr.microsoft.com/dotnet/sdk:7.0 as build | ||
|
||
WORKDIR /src | ||
|
||
COPY ./GainsTracker.CoreAPI/GainsTracker.CoreAPI.csproj GainsTracker.CoreAPI/ | ||
|
||
RUN dotnet restore GainsTracker.CoreAPI/GainsTracker.CoreAPI.csproj | ||
|
||
WORKDIR /src/GainsTracker.CoreAPI | ||
COPY . . | ||
|
||
RUN dotnet build GainsTracker.CoreAPI/GainsTracker.CoreAPI.csproj -c Release -o /app/build | ||
|
||
FROM build AS publish | ||
RUN dotnet publish GainsTracker.CoreAPI/GainsTracker.CoreAPI.csproj -c Release -o /app/publish --self-contained false | ||
|
||
FROM mcr.microsoft.com/dotnet/aspnet:7.0 as runtime | ||
|
||
ENV ASPNETCORE_URLS=http://*:4040 | ||
ENV ASPNETCORE_ENVIRONMENT=Development | ||
|
||
WORKDIR /app | ||
COPY --from=publish /app/publish . | ||
EXPOSE 4040 | ||
|
||
ENTRYPOINT ["dotnet", "GainsTracker.CoreAPI.dll"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,45 +1,53 @@ | ||
using System.Text.Json.Serialization; | ||
using GainsTracker.CoreAPI.Configurations; | ||
|
||
WebApplicationBuilder builder = WebApplication.CreateBuilder(args); | ||
namespace GainsTracker.CoreAPI; | ||
|
||
builder.Services.AddControllers() | ||
.AddJsonOptions(options => | ||
public static class Program | ||
{ | ||
public static void Main(string[] args) | ||
{ | ||
options.JsonSerializerOptions.ReferenceHandler = ReferenceHandler.IgnoreCycles; | ||
options.JsonSerializerOptions.Converters.Add(new JsonStringEnumConverter()); | ||
}); | ||
WebApplicationBuilder builder = WebApplication.CreateBuilder(args); | ||
|
||
builder.Services.AddEndpointsApiExplorer(); | ||
builder.Services.AddControllers() | ||
.AddJsonOptions(options => | ||
{ | ||
options.JsonSerializerOptions.ReferenceHandler = ReferenceHandler.IgnoreCycles; | ||
options.JsonSerializerOptions.Converters.Add(new JsonStringEnumConverter()); | ||
}); | ||
|
||
// Configuration. | ||
builder.ConfigureContextAndIdentity(); | ||
builder.ConfigureAuthentication(); | ||
builder.AddSwaggerDocumentation(); | ||
builder.ConfigureCors(); | ||
builder.RegisterEpicDependencies(); | ||
builder.Services.AddEndpointsApiExplorer(); | ||
|
||
WebApplication app = builder.Build(); | ||
// Configuration. | ||
builder.ConfigureContextAndIdentity(); | ||
builder.ConfigureAuthentication(); | ||
builder.AddSwaggerDocumentation(); | ||
builder.ConfigureCors(); | ||
builder.RegisterEpicDependencies(); | ||
|
||
app.ResetAndUpdateDatabase(false); | ||
WebApplication app = builder.Build(); | ||
|
||
// Configure the HTTP request pipeline. | ||
if (app.Environment.IsDevelopment()) | ||
{ | ||
app.UseSwagger(); | ||
app.UseSwaggerUI(); | ||
} | ||
app.ResetAndUpdateDatabase(); | ||
|
||
app.UseCors("AllowBlazorDevClient"); | ||
app.UseHttpsRedirection(); | ||
// Configure the HTTP request pipeline. | ||
if (app.Environment.IsDevelopment()) | ||
{ | ||
app.UseSwagger(); | ||
app.UseSwaggerUI(); | ||
} | ||
|
||
// Authentication | ||
app.UseAuthentication(); | ||
app.UseAuthorization(); | ||
app.UseCors("AllowBlazorDevClient"); | ||
app.UseHttpsRedirection(); | ||
|
||
// Custom exception handling | ||
app.AddGlobalErrorHandler(); | ||
// Authentication | ||
app.UseAuthentication(); | ||
app.UseAuthorization(); | ||
|
||
app.MapControllers(); | ||
// Custom exception handling | ||
app.AddGlobalErrorHandler(); | ||
|
||
app.Run(); | ||
app.MapControllers(); | ||
|
||
app.Run(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters