# Development Dockerfile for .NET API
FROM mcr.microsoft.com/dotnet/aspnet:8.0 AS base
WORKDIR /app
EXPOSE 5000

FROM mcr.microsoft.com/dotnet/sdk:8.0 AS build
WORKDIR /src

# Copy project files
COPY ["DramaLing.API/DramaLing.API.csproj", "DramaLing.API/"]
COPY ["DramaLing.Application/DramaLing.Application.csproj", "DramaLing.Application/"]
COPY ["DramaLing.Core/DramaLing.Core.csproj", "DramaLing.Core/"]
COPY ["DramaLing.Infrastructure/DramaLing.Infrastructure.csproj", "DramaLing.Infrastructure/"]

# Restore dependencies
RUN dotnet restore "DramaLing.API/DramaLing.API.csproj"

# Copy source code
COPY . .

# Build the application
WORKDIR "/src/DramaLing.API"
RUN dotnet build "DramaLing.API.csproj" -c Release -o /app/build

FROM build AS publish
RUN dotnet publish "DramaLing.API.csproj" -c Release -o /app/publish /p:UseAppHost=false

FROM base AS final
WORKDIR /app
COPY --from=publish /app/publish .

# Create logs directory
RUN mkdir -p /app/logs

ENTRYPOINT ["dotnet", "DramaLing.API.dll"]