-
Notifications
You must be signed in to change notification settings - Fork 2
/
Dockerfile
30 lines (21 loc) · 992 Bytes
/
Dockerfile
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
# Stage 1: Build the application
FROM mcr.microsoft.com/dotnet/sdk:8.0 AS build
# Set the working directory inside the container
WORKDIR /app
# Add the custom NuGet source before restoring dependencies
RUN dotnet nuget add source https://pkgs.dev.azure.com/tgbots/Telegram.Bot/_packaging/release/nuget/v3/index.json -n Telegram.Bot
# Copy the .csproj file and restore any dependencies from both default and custom sources
COPY Ollabotica/Ollabotica.csproj ./
RUN dotnet restore
# Copy the rest of the application source code
COPY . ./
# Build the application in Release mode
RUN dotnet publish -c Release -o /app/publish
# Stage 2: Use the ASP.NET Core runtime to run the application
FROM mcr.microsoft.com/dotnet/aspnet:8.0 AS runtime
# Set the working directory in the final runtime container
WORKDIR /app
# Copy the built application from the previous stage
COPY --from=build /app/publish .
# Set the entry point to the console application
ENTRYPOINT ["dotnet", "Ollabotica.dll"]