Dockerfile added
This commit is contained in:
25
WatchIt.WebAPI/Dockerfile
Normal file
25
WatchIt.WebAPI/Dockerfile
Normal file
@@ -0,0 +1,25 @@
|
|||||||
|
FROM mcr.microsoft.com/dotnet/aspnet:9.0 AS base
|
||||||
|
USER $APP_UID
|
||||||
|
WORKDIR /app
|
||||||
|
EXPOSE 8080
|
||||||
|
EXPOSE 8081
|
||||||
|
|
||||||
|
FROM mcr.microsoft.com/dotnet/sdk:9.0 AS build
|
||||||
|
ARG BUILD_CONFIGURATION=Release
|
||||||
|
WORKDIR /src
|
||||||
|
COPY ["WatchIt.WebAPI/WatchIt.WebAPI.csproj", "WatchIt.WebAPI/"]
|
||||||
|
COPY ["WatchIt.Database/WatchIt.Database.csproj", "WatchIt.Database/"]
|
||||||
|
COPY ["WatchIt.DTO/WatchIt.DTO.csproj", "WatchIt.DTO/"]
|
||||||
|
RUN dotnet restore "WatchIt.WebAPI/WatchIt.WebAPI.csproj"
|
||||||
|
COPY . .
|
||||||
|
WORKDIR "/src/WatchIt.WebAPI"
|
||||||
|
RUN dotnet build "WatchIt.WebAPI.csproj" -c $BUILD_CONFIGURATION -o /app/build
|
||||||
|
|
||||||
|
FROM build AS publish
|
||||||
|
ARG BUILD_CONFIGURATION=Release
|
||||||
|
RUN dotnet publish "WatchIt.WebAPI.csproj" -c $BUILD_CONFIGURATION -o /app/publish /p:UseAppHost=false
|
||||||
|
|
||||||
|
FROM base AS final
|
||||||
|
WORKDIR /app
|
||||||
|
COPY --from=publish /app/publish .
|
||||||
|
ENTRYPOINT ["dotnet", "WatchIt.WebAPI.dll"]
|
||||||
@@ -4,6 +4,7 @@
|
|||||||
<TargetFramework>net9.0</TargetFramework>
|
<TargetFramework>net9.0</TargetFramework>
|
||||||
<Nullable>enable</Nullable>
|
<Nullable>enable</Nullable>
|
||||||
<ImplicitUsings>enable</ImplicitUsings>
|
<ImplicitUsings>enable</ImplicitUsings>
|
||||||
|
<DockerDefaultTargetOS>Linux</DockerDefaultTargetOS>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
@@ -29,4 +30,19 @@
|
|||||||
<ProjectReference Include="..\WatchIt.DTO\WatchIt.DTO.csproj" />
|
<ProjectReference Include="..\WatchIt.DTO\WatchIt.DTO.csproj" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<Content Include="..\.dockerignore">
|
||||||
|
<Link>.dockerignore</Link>
|
||||||
|
</Content>
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<_ContentIncludedByDefault Remove="WatchIt.WebAPI.Controllers\obj\project.assets.json" />
|
||||||
|
<_ContentIncludedByDefault Remove="WatchIt.WebAPI.Controllers\obj\project.packagespec.json" />
|
||||||
|
<_ContentIncludedByDefault Remove="WatchIt.WebAPI.Controllers\obj\WatchIt.WebAPI.Controllers.csproj.nuget.dgspec.json" />
|
||||||
|
<_ContentIncludedByDefault Remove="WatchIt.WebAPI.Validators\obj\project.assets.json" />
|
||||||
|
<_ContentIncludedByDefault Remove="WatchIt.WebAPI.Validators\obj\project.packagespec.json" />
|
||||||
|
<_ContentIncludedByDefault Remove="WatchIt.WebAPI.Validators\obj\WatchIt.WebAPI.Validators.csproj.nuget.dgspec.json" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
</Project>
|
</Project>
|
||||||
|
|||||||
25
WatchIt.Website/Dockerfile
Normal file
25
WatchIt.Website/Dockerfile
Normal file
@@ -0,0 +1,25 @@
|
|||||||
|
FROM mcr.microsoft.com/dotnet/aspnet:9.0 AS base
|
||||||
|
USER $APP_UID
|
||||||
|
WORKDIR /app
|
||||||
|
EXPOSE 8080
|
||||||
|
EXPOSE 8081
|
||||||
|
|
||||||
|
FROM mcr.microsoft.com/dotnet/sdk:9.0 AS build
|
||||||
|
ARG BUILD_CONFIGURATION=Release
|
||||||
|
WORKDIR /src
|
||||||
|
COPY ["WatchIt.Website/WatchIt.Website.csproj", "WatchIt.Website/"]
|
||||||
|
COPY ["WatchIt.DTO/WatchIt.DTO.csproj", "WatchIt.DTO/"]
|
||||||
|
COPY ["WatchIt.Database/WatchIt.Database.csproj", "WatchIt.Database/"]
|
||||||
|
RUN dotnet restore "WatchIt.Website/WatchIt.Website.csproj"
|
||||||
|
COPY . .
|
||||||
|
WORKDIR "/src/WatchIt.Website"
|
||||||
|
RUN dotnet build "WatchIt.Website.csproj" -c $BUILD_CONFIGURATION -o /app/build
|
||||||
|
|
||||||
|
FROM build AS publish
|
||||||
|
ARG BUILD_CONFIGURATION=Release
|
||||||
|
RUN dotnet publish "WatchIt.Website.csproj" -c $BUILD_CONFIGURATION -o /app/publish /p:UseAppHost=false
|
||||||
|
|
||||||
|
FROM base AS final
|
||||||
|
WORKDIR /app
|
||||||
|
COPY --from=publish /app/publish .
|
||||||
|
ENTRYPOINT ["dotnet", "WatchIt.Website.dll"]
|
||||||
@@ -5,6 +5,7 @@
|
|||||||
<Nullable>enable</Nullable>
|
<Nullable>enable</Nullable>
|
||||||
<ImplicitUsings>enable</ImplicitUsings>
|
<ImplicitUsings>enable</ImplicitUsings>
|
||||||
<LangVersion>13</LangVersion>
|
<LangVersion>13</LangVersion>
|
||||||
|
<DockerDefaultTargetOS>Linux</DockerDefaultTargetOS>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
@@ -72,6 +73,24 @@
|
|||||||
<_ContentIncludedByDefault Remove="wwwroot\lib\bootstrap\dist\js\bootstrap.js.map" />
|
<_ContentIncludedByDefault Remove="wwwroot\lib\bootstrap\dist\js\bootstrap.js.map" />
|
||||||
<_ContentIncludedByDefault Remove="wwwroot\lib\bootstrap\dist\js\bootstrap.min.js" />
|
<_ContentIncludedByDefault Remove="wwwroot\lib\bootstrap\dist\js\bootstrap.min.js" />
|
||||||
<_ContentIncludedByDefault Remove="wwwroot\lib\bootstrap\dist\js\bootstrap.min.js.map" />
|
<_ContentIncludedByDefault Remove="wwwroot\lib\bootstrap\dist\js\bootstrap.min.js.map" />
|
||||||
|
<_ContentIncludedByDefault Remove="WatchIt.Website.Services\WatchIt.Website.Services.Authentication\obj\project.assets.json" />
|
||||||
|
<_ContentIncludedByDefault Remove="WatchIt.Website.Services\WatchIt.Website.Services.Authentication\obj\project.packagespec.json" />
|
||||||
|
<_ContentIncludedByDefault Remove="WatchIt.Website.Services\WatchIt.Website.Services.Authentication\obj\WatchIt.Website.Services.Authentication.csproj.nuget.dgspec.json" />
|
||||||
|
<_ContentIncludedByDefault Remove="WatchIt.Website.Services\WatchIt.Website.Services.Client\obj\project.assets.json" />
|
||||||
|
<_ContentIncludedByDefault Remove="WatchIt.Website.Services\WatchIt.Website.Services.Client\obj\project.packagespec.json" />
|
||||||
|
<_ContentIncludedByDefault Remove="WatchIt.Website.Services\WatchIt.Website.Services.Client\obj\WatchIt.Website.Services.Client.csproj.nuget.dgspec.json" />
|
||||||
|
<_ContentIncludedByDefault Remove="WatchIt.Website.Services\WatchIt.Website.Services.Configuration\obj\project.assets.json" />
|
||||||
|
<_ContentIncludedByDefault Remove="WatchIt.Website.Services\WatchIt.Website.Services.Configuration\obj\project.packagespec.json" />
|
||||||
|
<_ContentIncludedByDefault Remove="WatchIt.Website.Services\WatchIt.Website.Services.Configuration\obj\WatchIt.Website.Services.Configuration.csproj.nuget.dgspec.json" />
|
||||||
|
<_ContentIncludedByDefault Remove="WatchIt.Website.Services\WatchIt.Website.Services.Tokens\obj\project.assets.json" />
|
||||||
|
<_ContentIncludedByDefault Remove="WatchIt.Website.Services\WatchIt.Website.Services.Tokens\obj\project.packagespec.json" />
|
||||||
|
<_ContentIncludedByDefault Remove="WatchIt.Website.Services\WatchIt.Website.Services.Tokens\obj\WatchIt.Website.Services.Tokens.csproj.nuget.dgspec.json" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<Content Include="..\.dockerignore">
|
||||||
|
<Link>.dockerignore</Link>
|
||||||
|
</Content>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
</Project>
|
</Project>
|
||||||
|
|||||||
Reference in New Issue
Block a user