25 lines
805 B
Docker
25 lines
805 B
Docker
# Use the official .NET SDK image to build the application
|
|
FROM mcr.microsoft.com/dotnet/sdk:8.0 AS build
|
|
WORKDIR /src
|
|
|
|
# Copy the project files and restore dependencies
|
|
COPY ["API/API.csproj", "API/"]
|
|
COPY ["Application/Application.csproj", "Application/"]
|
|
COPY ["Domain/Domain.csproj", "Domain/"]
|
|
COPY ["Infrastructure/Infrastructure.csproj", "Infrastructure/"]
|
|
|
|
RUN dotnet restore "API/API.csproj"
|
|
|
|
# Copy the remaining source code and build the application
|
|
COPY . .
|
|
WORKDIR "/src/API"
|
|
RUN dotnet build "API.csproj" -c Release -o /app/build
|
|
RUN dotnet publish "API.csproj" -c Release -o /app/publish
|
|
|
|
# Use the official .NET runtime image to run the application
|
|
FROM mcr.microsoft.com/dotnet/aspnet:8.0 AS base
|
|
WORKDIR /app
|
|
EXPOSE 5022
|
|
COPY --from=build /app/publish .
|
|
ENTRYPOINT ["dotnet", "API.dll"]
|