Add dockerfile

This commit is contained in:
Sergey Nazarov 2024-03-19 20:21:13 +04:00
parent e26734d0d2
commit 2976bd0d83
3 changed files with 49 additions and 0 deletions

25
.dockerignore Normal file
View File

@ -0,0 +1,25 @@
**/.dockerignore
**/.env
**/.git
**/.gitignore
**/.project
**/.settings
**/.toolstarget
**/.vs
**/.vscode
**/.idea
**/*.*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

View File

@ -0,0 +1,18 @@
FROM mcr.microsoft.com/dotnet/aspnet:8.0 AS base
WORKDIR /app
FROM mcr.microsoft.com/dotnet/sdk:8.0 AS build
WORKDIR /src
COPY . .
RUN dotnet restore "src/Nocr.TelegramClient.Host/Nocr.TelegramClient.Host.csproj"
WORKDIR "/src/src/Nocr.TelegramClient.Host"
RUN dotnet build "Nocr.TelegramClient.Host.csproj" -c Release -o /app/build
FROM build AS publish
RUN dotnet publish "Nocr.TelegramClient.Host.csproj" -c Release -o /app/publish
FROM base AS final
WORKDIR /app
COPY --from=publish /app/publish .
ENTRYPOINT ["dotnet", "Nocr.TelegramClient.Host.dll"]

View File

@ -14,4 +14,10 @@
<ProjectReference Include="..\Nocr.TelegramClient.Core\Nocr.TelegramClient.Core.csproj" />
</ItemGroup>
<ItemGroup>
<Content Include="..\..\.dockerignore">
<Link>.dockerignore</Link>
</Content>
</ItemGroup>
</Project>