From 66d5507833281d74865b7a0da73cdaca44a70028 Mon Sep 17 00:00:00 2001 From: samatrhea Date: Wed, 20 Mar 2024 15:40:02 +0100 Subject: [PATCH] [Update] Docker file and appsettings --- reqifviewer/Dockerfile | 22 ++++++++++++++++------ reqifviewer/appsettings.json | 8 +------- reqifviewer/reqifviewer.csproj | 2 +- 3 files changed, 18 insertions(+), 14 deletions(-) diff --git a/reqifviewer/Dockerfile b/reqifviewer/Dockerfile index 19d8a02..f638733 100644 --- a/reqifviewer/Dockerfile +++ b/reqifviewer/Dockerfile @@ -1,16 +1,26 @@ -FROM mcr.microsoft.com/dotnet/sdk:8.0 AS build +# syntax=docker/dockerfile:1.4 -WORKDIR /src +FROM mcr.microsoft.com/dotnet/sdk:8.0 AS build COPY Nuget.Config . COPY reqifviewer reqifviewer RUN dotnet restore --configfile Nuget.Config reqifviewer RUN dotnet build --no-restore reqifviewer -c Release -o /app/build +RUN dotnet build "reqifviewer/reqifviewer.csproj" -c Release -o /app/build --no-restore + FROM build AS publish RUN dotnet publish reqifviewer -c Release -o /app/publish -FROM nginx:alpine AS final -WORKDIR /usr/share/nginx/html -COPY --from=publish /app/publish/wwwroot . -COPY reqifviewer/nginx.conf /etc/nginx/nginx.conf \ No newline at end of file +FROM mcr.microsoft.com/dotnet/aspnet:8.0.3-alpine3.19 AS final + +WORKDIR /app +RUN mkdir /app/logs + +COPY --from=publish /app/publish . + +# Create a non-root user and give this user access to the working directory +RUN chown -R $APP_UID /app +USER $APP_UID + +ENTRYPOINT ["dotnet", "reqifviewer.dll"] \ No newline at end of file diff --git a/reqifviewer/appsettings.json b/reqifviewer/appsettings.json index 62bee75..bcd33de 100644 --- a/reqifviewer/appsettings.json +++ b/reqifviewer/appsettings.json @@ -1,11 +1,5 @@ { - "Kestrel": { - "Endpoints": { - "MyHttpEndpoint": { - "Url": "http://localhost:5000" - } - } - }, + "AllowedHosts": "*", "Serilog": { "Using": [ "Serilog.Sinks.Console", "Serilog.Sinks.File" ], "MinimumLevel": { diff --git a/reqifviewer/reqifviewer.csproj b/reqifviewer/reqifviewer.csproj index cf81fd8..40b3631 100644 --- a/reqifviewer/reqifviewer.csproj +++ b/reqifviewer/reqifviewer.csproj @@ -2,7 +2,7 @@ reqifviewer - 0.18.0 + 1.0.0 Web Application to inspect ReqIF files net8.0