Add production docker file for backend

This commit is contained in:
Kasper Juul Hermansen 2021-11-14 15:35:09 +01:00
parent ce3d351769
commit 6ffc55f64e
Signed by: kjuulh
GPG Key ID: 0F95C140730F2F23
27 changed files with 14 additions and 7 deletions

View File

@ -5,11 +5,18 @@ EXPOSE 443
FROM mcr.microsoft.com/dotnet/sdk:6.0 AS build
WORKDIR /src
COPY ["Todo.Api/Todo.Api.csproj", "Todo.Api/"]
RUN dotnet restore "Todo.Api/Todo.Api.csproj"
COPY *.sln .
COPY ["src/Todo.Api/Todo.Api.csproj", "src/Todo.Api/"]
COPY ["src/Todo.Core/Todo.Core.csproj", "src/Todo.Core/"]
COPY ["src/Todo.Persistence/Todo.Persistence.csproj", "src/Todo.Persistence/"]
RUN dotnet restore .
COPY . .
WORKDIR "/src/Todo.Api"
RUN dotnet build "Todo.Api.csproj" -c Release -o /app/build
WORKDIR "src/Todo.Api"
RUN dotnet build . -c Release -o /app/build
FROM build AS publish
RUN dotnet publish "Todo.Api.csproj" -c Release -o /app/publish

View File

@ -1,10 +1,10 @@

Microsoft Visual Studio Solution File, Format Version 12.00
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Todo.Api", "Todo.Api\Todo.Api.csproj", "{FA037FDE-DAA4-4A95-ABA5-64DCFEDDBA4E}"
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Todo.Api", "src\Todo.Api\Todo.Api.csproj", "{FA037FDE-DAA4-4A95-ABA5-64DCFEDDBA4E}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Todo.Persistence", "Todo.Persistence\Todo.Persistence.csproj", "{7636E7CC-C9A5-41D4-BBFE-B107497A5C8A}"
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Todo.Persistence", "src\Todo.Persistence\Todo.Persistence.csproj", "{7636E7CC-C9A5-41D4-BBFE-B107497A5C8A}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Todo.Core", "Todo.Core\Todo.Core.csproj", "{F134CAB6-15A5-45CB-8782-B61AB67B5C9C}"
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Todo.Core", "src\Todo.Core\Todo.Core.csproj", "{F134CAB6-15A5-45CB-8782-B61AB67B5C9C}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution