# Development Dockerfile for WorkClub.Api
# Enables hot reload via dotnet watch with volume mounts
FROM mcr.microsoft.com/dotnet/sdk:10.0

WORKDIR /app

# Install dotnet-ef tool for migrations
RUN dotnet tool install --global dotnet-ef
ENV PATH="/root/.dotnet/tools:${PATH}"

# Layer caching: Copy solution and project files first
COPY WorkClub.slnx .
COPY global.json .
COPY WorkClub.Api/*.csproj ./WorkClub.Api/
COPY WorkClub.Application/*.csproj ./WorkClub.Application/
COPY WorkClub.Domain/*.csproj ./WorkClub.Domain/
COPY WorkClub.Infrastructure/*.csproj ./WorkClub.Infrastructure/
COPY WorkClub.Tests.Integration/*.csproj ./WorkClub.Tests.Integration/
COPY WorkClub.Tests.Unit/*.csproj ./WorkClub.Tests.Unit/

# Restore dependencies (cached layer)
RUN dotnet restore WorkClub.slnx

# Copy source code
COPY . .

# Expose default ASP.NET Core port
EXPOSE 8080

# Hot reload: dotnet watch monitors file changes in mounted volumes
ENTRYPOINT ["dotnet", "watch", "run", "--project", "WorkClub.Api/WorkClub.Api.csproj"]
