############################################
## Build
FROM mcr.microsoft.com/dotnet/sdk:6.0.300 AS build
WORKDIR /nupkg
COPY nupkg .
WORKDIR /build
RUN dotnet new --install /nupkg/Umbraco.Templates.*.nupkg
RUN dotnet new umbraco --name Cypress -o . --no-restore
RUN dotnet restore -s /nupkg -s https://api.nuget.org/v3/index.json
RUN dotnet publish --no-restore --configuration Release -o /dist
## Run
FROM mcr.microsoft.com/dotnet/aspnet:6.0.5 AS run
WORKDIR /cypress
COPY --from=build dist .
ENV ASPNETCORE_URLS="http://0.0.0.0:5000"
ENV Umbraco__CMS__Global__InstallMissingDatabase="true"
ENV ConnectionStrings__umbracoDbDSN_ProviderName="Microsoft.Data.Sqlite"
ENV ConnectionStrings__umbracoDbDSN="Data Source=|DataDirectory|/Umbraco.sqlite.db;Cache=Shared;Foreign Keys=True;Pooling=True"
ENV Umbraco__CMS__Unattended__InstallUnattended="true"
ENV Umbraco__CMS__Unattended__UnattendedUserName="Cypress Test"
ENV Umbraco__CMS__Unattended__UnattendedUserEmail="cypress@umbraco.com"
ENV Umbraco__CMS__Unattended__UnattendedUserPassword="UmbracoAcceptance123!"
CMD dotnet Cypress.dll