From c3c9ad26ea54fbac058d05376dca9902fe90639b Mon Sep 17 00:00:00 2001 From: "felix.mielcarek" Date: Thu, 21 Sep 2023 11:46:55 +0200 Subject: [PATCH] Ajout Dockerfile --- Sources/.dockerignore | 25 +++++ Sources/OpenLibraryWrapper/Dockerfile | 31 ++++++ .../OpenLibraryWrapper.csproj | 3 + .../Properties/launchSettings.json | 103 ++++++++++-------- 4 files changed, 114 insertions(+), 48 deletions(-) create mode 100644 Sources/.dockerignore create mode 100644 Sources/OpenLibraryWrapper/Dockerfile diff --git a/Sources/.dockerignore b/Sources/.dockerignore new file mode 100644 index 0000000..bdca33b --- /dev/null +++ b/Sources/.dockerignore @@ -0,0 +1,25 @@ +**/.classpath +**/.dockerignore +**/.env +**/.git +**/.gitignore +**/.project +**/.settings +**/.toolstarget +**/.vs +**/.vscode +**/*.*proj.user +**/*.dbmdl +**/*.jfm +**/azds.yaml +**/bin +**/charts +**/docker-compose* +**/Dockerfile* +**/node_modules +**/npm-debug.log +**/obj +**/secrets.dev.yaml +**/values.dev.yaml +LICENSE +README.md \ No newline at end of file diff --git a/Sources/OpenLibraryWrapper/Dockerfile b/Sources/OpenLibraryWrapper/Dockerfile new file mode 100644 index 0000000..70630f3 --- /dev/null +++ b/Sources/OpenLibraryWrapper/Dockerfile @@ -0,0 +1,31 @@ +#See https://aka.ms/customizecontainer to learn how to customize your debug container and how Visual Studio uses this Dockerfile to build your images for faster debugging. + +FROM mcr.microsoft.com/dotnet/aspnet:7.0 AS base +WORKDIR /app +EXPOSE 80 +EXPOSE 443 + +FROM mcr.microsoft.com/dotnet/sdk:7.0 AS build +WORKDIR /src +COPY ["OpenLibraryWrapper/OpenLibraryWrapper.csproj", "OpenLibraryWrapper/"] +COPY ["LibraryDTO/LibraryDTO.csproj", "LibraryDTO/"] +COPY ["StubbedDTO/StubbedDTO.csproj", "StubbedDTO/"] +COPY ["JsonReader/JsonReader.csproj", "JsonReader/"] +COPY ["DtoAbstractLayer/DtoAbstractLayer.csproj", "DtoAbstractLayer/"] +COPY ["OpenLibraryClient/OpenLibraryClient.csproj", "OpenLibraryClient/"] +COPY ["MyLibraryManager/MyLibraryManager.csproj", "MyLibraryManager/"] +COPY ["MyLibraryDB/MyLibraryDB.csproj", "MyLibraryDB/"] +COPY ["MyLibraryEntities/MyLibraryEntities.csproj", "MyLibraryEntities/"] +COPY ["StubbedDB/StubbedDB.csproj", "StubbedDB/"] +RUN dotnet restore "OpenLibraryWrapper/OpenLibraryWrapper.csproj" +COPY . . +WORKDIR "/src/OpenLibraryWrapper" +RUN dotnet build "OpenLibraryWrapper.csproj" -c Release -o /app/build + +FROM build AS publish +RUN dotnet publish "OpenLibraryWrapper.csproj" -c Release -o /app/publish /p:UseAppHost=false + +FROM base AS final +WORKDIR /app +COPY --from=publish /app/publish . +ENTRYPOINT ["dotnet", "OpenLibraryWrapper.dll"] \ No newline at end of file diff --git a/Sources/OpenLibraryWrapper/OpenLibraryWrapper.csproj b/Sources/OpenLibraryWrapper/OpenLibraryWrapper.csproj index a235a9d..edf26d7 100644 --- a/Sources/OpenLibraryWrapper/OpenLibraryWrapper.csproj +++ b/Sources/OpenLibraryWrapper/OpenLibraryWrapper.csproj @@ -4,6 +4,8 @@ net7.0 enable enable + 93192ff3-7009-4b4e-aac2-cc7db3dc7c9a + Linux @@ -16,6 +18,7 @@ + diff --git a/Sources/OpenLibraryWrapper/Properties/launchSettings.json b/Sources/OpenLibraryWrapper/Properties/launchSettings.json index e4b2966..137c0e6 100644 --- a/Sources/OpenLibraryWrapper/Properties/launchSettings.json +++ b/Sources/OpenLibraryWrapper/Properties/launchSettings.json @@ -1,49 +1,56 @@ -{ - "$schema": "https://json.schemastore.org/launchsettings.json", - "iisSettings": { - "windowsAuthentication": false, - "anonymousAuthentication": true, - "iisExpress": { - "applicationUrl": "http://localhost:34424", - "sslPort": 44344 - } - }, - "profiles": { - "http": { - "commandName": "Project", - "launchBrowser": true, - "launchUrl": "swagger", - "applicationUrl": "http://localhost:5117", - "environmentVariables": { - "ASPNETCORE_ENVIRONMENT": "Development" - }, - "dotnetRunMessages": true - }, - "https": { - "commandName": "Project", - "launchBrowser": true, - "launchUrl": "swagger", - "applicationUrl": "https://localhost:7263;http://localhost:5117", - "environmentVariables": { - "ASPNETCORE_ENVIRONMENT": "Development" - }, - "dotnetRunMessages": true - }, - "IIS Express": { - "commandName": "IISExpress", - "launchBrowser": true, - "launchUrl": "swagger", - "environmentVariables": { - "ASPNETCORE_ENVIRONMENT": "Development" - } - }, - "OpenLibraryWrapper": { - "commandName": "Project", - "launchBrowser": true, - "applicationUrl": "https://localhost:34198;http://localhost:46179", - "environmentVariables": { - "ASPNETCORE_ENVIRONMENT": "Development" - } - } - } +{ + "profiles": { + "http": { + "commandName": "Project", + "launchBrowser": true, + "launchUrl": "swagger", + "environmentVariables": { + "ASPNETCORE_ENVIRONMENT": "Development" + }, + "applicationUrl": "http://localhost:5117", + "dotnetRunMessages": true + }, + "https": { + "commandName": "Project", + "launchBrowser": true, + "launchUrl": "swagger", + "environmentVariables": { + "ASPNETCORE_ENVIRONMENT": "Development" + }, + "applicationUrl": "https://localhost:7263;http://localhost:5117", + "dotnetRunMessages": true + }, + "IIS Express": { + "commandName": "IISExpress", + "launchBrowser": true, + "launchUrl": "swagger", + "environmentVariables": { + "ASPNETCORE_ENVIRONMENT": "Development" + } + }, + "OpenLibraryWrapper": { + "commandName": "Project", + "launchBrowser": true, + "environmentVariables": { + "ASPNETCORE_ENVIRONMENT": "Development" + }, + "applicationUrl": "https://localhost:34198;http://localhost:46179" + }, + "Docker": { + "commandName": "Docker", + "launchBrowser": true, + "launchUrl": "{Scheme}://{ServiceHost}:{ServicePort}/swagger", + "publishAllPorts": true, + "useSSL": true + } + }, + "$schema": "https://json.schemastore.org/launchsettings.json", + "iisSettings": { + "windowsAuthentication": false, + "anonymousAuthentication": true, + "iisExpress": { + "applicationUrl": "http://localhost:34424", + "sslPort": 44344 + } + } } \ No newline at end of file