# Use official .NET SDK image to build the project FROM mcr.microsoft.com/dotnet/sdk:8.0 AS build WORKDIR /app # Copy project files and restore dependencies COPY . ./ RUN dotnet restore # Build the application RUN dotnet publish -c Release -o /out --no-restore # Use a smaller runtime image for final container FROM mcr.microsoft.com/dotnet/aspnet:8.0 AS runtime WORKDIR /app # Copy built files from build stage COPY --from=build /out . # Expose the port EXPOSE 5000 EXPOSE 5001 # Start the application ENTRYPOINT ["dotnet", "UserApi.dll"]