-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile.backend
More file actions
37 lines (28 loc) · 1.73 KB
/
Dockerfile.backend
File metadata and controls
37 lines (28 loc) · 1.73 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
# Базовый образ для сборки
FROM mcr.microsoft.com/dotnet/sdk:8.0 AS build
WORKDIR /app
# Добавляем кастомный NuGet-репозиторий
RUN dotnet nuget add source "https://pkgs.dev.azure.com/tgbots/Telegram.Bot/_packaging/release/nuget/v3/index.json" --name TelegramBotCustom
# Добавляем стандартный источник NuGet, если еще не добавлен
#RUN dotnet nuget add source https://api.nuget.org/v3/index.json --name nuget.org
# Копируем файлы проекта
COPY SuperBot.Telegram/SuperBot.Telegram.csproj SuperBot.Telegram/
COPY SuperBot.Application/SuperBot.Application.csproj SuperBot.Application/
COPY SuperBot.Core/SuperBot.Core.csproj SuperBot.Core/
COPY SuperBot.Infrastructure/SuperBot.Infrastructure.csproj SuperBot.Infrastructure/
COPY SuperBot.BotApi/SuperBot.BotApi.csproj SuperBot.BotApi/
COPY SuperBot.Common.Auth/SuperBot.Common.Auth.csproj SuperBot.Common.Auth/
COPY SuperBot.WebApi/SuperBot.WebApi.csproj SuperBot.WebApi/
# Восстанавливаем зависимости
RUN dotnet restore SuperBot.WebApi/SuperBot.WebApi.csproj --source "https://pkgs.dev.azure.com/tgbots/Telegram.Bot/_packaging/release/nuget/v3/index.json" --source https://api.nuget.org/v3/index.json
# Копируем весь исходный код
COPY . .
# Собираем проект
RUN dotnet publish SuperBot.WebApi/SuperBot.WebApi.csproj -c Release -o /app/published
# Базовый образ для запуска
FROM mcr.microsoft.com/dotnet/aspnet:8.0 AS runtime
WORKDIR /app
# Копируем собранное приложение
COPY --from=build /app/published ./
# Запускаем бэкенд api
ENTRYPOINT ["dotnet", "SuperBot.WebApi.dll"]