From f695e3ef3a623d5580918ceb0c3e7cdb39439bec Mon Sep 17 00:00:00 2001
From: Pierre Ferreira
Date: Thu, 9 Feb 2023 15:09:01 +0100
Subject: [PATCH] Ajout dockerfile :green_heart:
---
Sources/API_LoL/API_LoL.csproj | 2 +-
Sources/API_LoL/Dockerfile | 7 ++++---
Sources/API_LoL/Dockerfile.original | 25 +++++++++++++++++++++++++
3 files changed, 30 insertions(+), 4 deletions(-)
create mode 100644 Sources/API_LoL/Dockerfile.original
diff --git a/Sources/API_LoL/API_LoL.csproj b/Sources/API_LoL/API_LoL.csproj
index 8902068..5ada54d 100644
--- a/Sources/API_LoL/API_LoL.csproj
+++ b/Sources/API_LoL/API_LoL.csproj
@@ -5,7 +5,7 @@
enable
enable
1c8da478-3029-41d1-b936-853a71a8b812
- Windows
+ Linux
diff --git a/Sources/API_LoL/Dockerfile b/Sources/API_LoL/Dockerfile
index 5634a24..7ff2075 100644
--- a/Sources/API_LoL/Dockerfile
+++ b/Sources/API_LoL/Dockerfile
@@ -1,8 +1,5 @@
#See https://aka.ms/containerfastmode to understand how Visual Studio uses this Dockerfile to build your images for faster debugging.
-#Depending on the operating system of the host machines(s) that will build or run the containers, the image specified in the FROM statement may need to be changed.
-#For more information, please see https://aka.ms/containercompat
-
FROM mcr.microsoft.com/dotnet/aspnet:6.0 AS base
WORKDIR /app
EXPOSE 80
@@ -11,6 +8,10 @@ EXPOSE 443
FROM mcr.microsoft.com/dotnet/sdk:6.0 AS build
WORKDIR /src
COPY ["API_LoL/API_LoL.csproj", "API_LoL/"]
+COPY ["DTO/DTO.csproj", "DTO/"]
+COPY ["Model/Model.csproj", "Model/"]
+COPY ["Shared/Shared.csproj", "Shared/"]
+COPY ["StubLib/StubLib.csproj", "StubLib/"]
RUN dotnet restore "API_LoL/API_LoL.csproj"
COPY . .
WORKDIR "/src/API_LoL"
diff --git a/Sources/API_LoL/Dockerfile.original b/Sources/API_LoL/Dockerfile.original
new file mode 100644
index 0000000..5634a24
--- /dev/null
+++ b/Sources/API_LoL/Dockerfile.original
@@ -0,0 +1,25 @@
+#See https://aka.ms/containerfastmode to understand how Visual Studio uses this Dockerfile to build your images for faster debugging.
+
+#Depending on the operating system of the host machines(s) that will build or run the containers, the image specified in the FROM statement may need to be changed.
+#For more information, please see https://aka.ms/containercompat
+
+FROM mcr.microsoft.com/dotnet/aspnet:6.0 AS base
+WORKDIR /app
+EXPOSE 80
+EXPOSE 443
+
+FROM mcr.microsoft.com/dotnet/sdk:6.0 AS build
+WORKDIR /src
+COPY ["API_LoL/API_LoL.csproj", "API_LoL/"]
+RUN dotnet restore "API_LoL/API_LoL.csproj"
+COPY . .
+WORKDIR "/src/API_LoL"
+RUN dotnet build "API_LoL.csproj" -c Release -o /app/build
+
+FROM build AS publish
+RUN dotnet publish "API_LoL.csproj" -c Release -o /app/publish /p:UseAppHost=false
+
+FROM base AS final
+WORKDIR /app
+COPY --from=publish /app/publish .
+ENTRYPOINT ["dotnet", "API_LoL.dll"]
\ No newline at end of file