# Build
FROM mcr.microsoft.com/dotnet/sdk:9.0 AS build
WORKDIR /src

# Copy all projects
COPY ["src", "."]

RUN dotnet workload install wasm-tools

RUN apt update
RUN apt install -y python

# Restore the Server
RUN dotnet restore 'MistoxWebsite.Server/MistoxWebsite.Server.csproj'

# Publish
FROM build as publish
RUN dotnet publish 'MistoxWebsite.Server/MistoxWebsite.Server.csproj' -c Release -o /app/publish

# Run the app
FROM mcr.microsoft.com/dotnet/aspnet:9.0
ENV ASPNETCORE_HTTP_PORTS=5001
ENV StripeKey=null
ENV MySQLServer=null
ENV MySQLUser=null
ENV MySQLPass=null
ENV MySQLDatabase=Mistox
EXPOSE 5001
WORKDIR /app
COPY --from=publish /app/publish .
ENTRYPOINT ["dotnet", "MistoxWebsite.Server.dll"]
