# Build stage
FROM mcr.microsoft.com/dotnet/sdk:10.0 AS launch
WORKDIR /src

# Install Python (required for AOT compilation)
RUN apt-get update && \
    apt-get install -y python3 && \
    ln -s /usr/bin/python3 /usr/bin/python


# Update workloads and SDK
RUN dotnet --list-sdks
RUN dotnet --list-runtimes
RUN dotnet workload update

# Copy project and solution files
COPY *.csproj *.sln ./

# Install required workloads
RUN dotnet workload install wasm-tools

# Copy the rest of the application
COPY . .

# Restore dependencies
RUN dotnet restore

# Publish the app (optional, if you want to test publish output)
# RUN dotnet publish -c Release -o /app/publish

# Runtime stage: Use the SDK image to run the app
ENTRYPOINT ["dotnet", "run", "--no-launch-profile", "--urls", "http://0.0.0.0:5000"]
EXPOSE 5000

