diff --git a/src/Lumina.Application/Lumina.Application.csproj b/src/Lumina.Application/Lumina.Application.csproj index 0d859873..962a6f7e 100644 --- a/src/Lumina.Application/Lumina.Application.csproj +++ b/src/Lumina.Application/Lumina.Application.csproj @@ -3,7 +3,7 @@ net8.0 disable enable - $(SolutionDir)..\bin\server\ + $(SolutionDir)..\bin\api\ false true diff --git a/src/Lumina.Contracts/Lumina.Contracts.csproj b/src/Lumina.Contracts/Lumina.Contracts.csproj index 572fe616..77d3ef94 100644 --- a/src/Lumina.Contracts/Lumina.Contracts.csproj +++ b/src/Lumina.Contracts/Lumina.Contracts.csproj @@ -3,7 +3,7 @@ net8.0 disable enable - $(SolutionDir)..\bin\server\ + $(SolutionDir)..\bin\api\ false true diff --git a/src/Lumina.DataAccess/Lumina.DataAccess.csproj b/src/Lumina.DataAccess/Lumina.DataAccess.csproj index c4c3389a..8853bf8b 100644 --- a/src/Lumina.DataAccess/Lumina.DataAccess.csproj +++ b/src/Lumina.DataAccess/Lumina.DataAccess.csproj @@ -3,7 +3,7 @@ net8.0 disable enable - $(SolutionDir)..\bin\server\ + $(SolutionDir)..\bin\api\ false true diff --git a/src/Lumina.Domain/Lumina.Domain.csproj b/src/Lumina.Domain/Lumina.Domain.csproj index f4da3886..7d360bf0 100644 --- a/src/Lumina.Domain/Lumina.Domain.csproj +++ b/src/Lumina.Domain/Lumina.Domain.csproj @@ -3,7 +3,7 @@ net8.0 disable enable - $(SolutionDir)..\bin\server\ + $(SolutionDir)..\bin\api\ false true diff --git a/src/Lumina.Infrastructure/Lumina.Infrastructure.csproj b/src/Lumina.Infrastructure/Lumina.Infrastructure.csproj index 38fe5331..03357b57 100644 --- a/src/Lumina.Infrastructure/Lumina.Infrastructure.csproj +++ b/src/Lumina.Infrastructure/Lumina.Infrastructure.csproj @@ -3,7 +3,7 @@ net8.0 disable enable - $(SolutionDir)..\bin\server\ + $(SolutionDir)..\bin\api\ false true diff --git a/src/Lumina.Presentation.Api/Dockerfile b/src/Lumina.Presentation.Api/Dockerfile index 8d78a4ec..b22810de 100644 --- a/src/Lumina.Presentation.Api/Dockerfile +++ b/src/Lumina.Presentation.Api/Dockerfile @@ -3,6 +3,7 @@ FROM mcr.microsoft.com/dotnet/aspnet:8.0 AS base USER app WORKDIR /app EXPOSE 5214 +EXPOSE 7057 # ==== Stage 1: Build stage FROM mcr.microsoft.com/dotnet/sdk:8.0 AS build @@ -49,8 +50,10 @@ WORKDIR /app COPY --from=publish /app/publish . ENV ASPNETCORE_HTTP_PORTS=5214 +ENV ASPNETCORE_HTTPS_PORTS=7057 EXPOSE 5214 +EXPOSE 7057 ENTRYPOINT ["dotnet", "Lumina.Presentation.Api.dll"] # to build this Docker image, run the following command from the root of the project (location of the .sln file): -# docker build --no-cache -t lumina-server -f Lumina.Presentation.Api/Dockerfile . \ No newline at end of file +# docker build --no-cache -t lumina-api -f Lumina.Presentation.Api/Dockerfile . diff --git a/src/Lumina.Presentation.Api/Properties/launchSettings.json b/src/Lumina.Presentation.Api/Properties/launchSettings.json index 5b8aa36c..103d664d 100644 --- a/src/Lumina.Presentation.Api/Properties/launchSettings.json +++ b/src/Lumina.Presentation.Api/Properties/launchSettings.json @@ -22,6 +22,7 @@ "commandName": "Docker", "launchUrl": "{Scheme}://{ServiceHost}:{ServicePort}", "environmentVariables": { + "ASPNETCORE_HTTPS_PORTS": "7057", "ASPNETCORE_HTTP_PORTS": "5214" }, "publishAllPorts": true, @@ -29,4 +30,4 @@ } }, "$schema": "http://json.schemastore.org/launchsettings.json" -} \ No newline at end of file +} diff --git a/src/Lumina.Presentation.Web/Dockerfile b/src/Lumina.Presentation.Web/Dockerfile new file mode 100644 index 00000000..51d02c14 --- /dev/null +++ b/src/Lumina.Presentation.Web/Dockerfile @@ -0,0 +1,50 @@ +# This stage is used when running from VS in fast mode (Default for Debug configuration) +FROM mcr.microsoft.com/dotnet/aspnet:8.0 AS base +USER app +WORKDIR /app +EXPOSE 5012 +EXPOSE 7112 + + +# ==== Stage 1: Build stage +FROM mcr.microsoft.com/dotnet/sdk:8.0 AS build + +ARG BUILD_CONFIGURATION=Release + +WORKDIR /src + +# restore NuGet packages (keeping this section separate from the rest of the project files allows Docker to cache the restored packages) +COPY ["AssemblyInfo_Shared.cs", "."] +COPY ["Lumina.Presentation.Web/Lumina.Presentation.Web.csproj", "Lumina.Presentation.Web/"] + +RUN dotnet restore "./Lumina.Presentation.Web/Lumina.Presentation.Web.csproj" /p:BaseOutputPath=/app/publish/ + +# build the project +COPY ["Lumina.Presentation.Web/", "Lumina.Presentation.Web/"] +COPY . . +WORKDIR /src/Lumina.Presentation.Web + +RUN dotnet build "./Lumina.Presentation.Web.csproj" -c $BUILD_CONFIGURATION -o /app/build /p:BaseOutputPath=/app/publish/ + +# ==== Stage 2: Publish stage +FROM build AS publish + +ARG BUILD_CONFIGURATION=Release + +RUN dotnet publish "./Lumina.Presentation.Web.csproj" -c $BUILD_CONFIGURATION -o /app/publish /p:UseAppHost=false /p:BaseOutputPath=/app/publish/ + +# ==== Stage 3: Run stage +#FROM mcr.microsoft.com/dotnet/aspnet:8.0 AS runtime +FROM base AS final + +WORKDIR /app + +COPY --from=publish /app/publish . +ENV ASPNETCORE_HTTP_PORTS=5012 +ENV ASPNETCORE_HTTPS_PORTS=7112 +EXPOSE 5012 +EXPOSE 7112 +ENTRYPOINT ["dotnet", "Lumina.Presentation.Web.dll"] + +# to build this Docker image, run the following command from the root of the project (location of the .sln file): +# docker build --no-cache -t lumina-web -f Lumina.Presentation.Web/Dockerfile . diff --git a/src/Lumina.Presentation.Web/Properties/launchSettings.json b/src/Lumina.Presentation.Web/Properties/launchSettings.json index 8a77d161..cc18997c 100644 --- a/src/Lumina.Presentation.Web/Properties/launchSettings.json +++ b/src/Lumina.Presentation.Web/Properties/launchSettings.json @@ -1,23 +1,31 @@ { - "$schema": "http://json.schemastore.org/launchsettings.json", - "profiles": { - "http": { - "commandName": "Project", - "dotnetRunMessages": true, - //"launchBrowser": true, - "applicationUrl": "http://localhost:5012", - "environmentVariables": { - "ASPNETCORE_ENVIRONMENT": "Development" - } - }, - "https": { - "commandName": "Project", - "dotnetRunMessages": true, - //"launchBrowser": true, - "applicationUrl": "http://localhost:5012;https://localhost:7112", - "environmentVariables": { - "ASPNETCORE_ENVIRONMENT": "Development" - } - } + "profiles": { + "http": { + "commandName": "Project", + "environmentVariables": { + "ASPNETCORE_ENVIRONMENT": "Development" + }, + "dotnetRunMessages": true, + "applicationUrl": "http://localhost:5012" + }, + "https": { + "commandName": "Project", + "environmentVariables": { + "ASPNETCORE_ENVIRONMENT": "Development" + }, + "dotnetRunMessages": true, + "applicationUrl": "http://localhost:5012;https://localhost:7112" + }, + "Container (Dockerfile)": { + "commandName": "Docker", + "launchUrl": "{Scheme}://{ServiceHost}:{ServicePort}", + "environmentVariables": { + "ASPNETCORE_HTTPS_PORTS": "7112", + "ASPNETCORE_HTTP_PORTS": "5012" + }, + "publishAllPorts": true, + "useSSL": true } + }, + "$schema": "http://json.schemastore.org/launchsettings.json" } diff --git a/src/docker-compose.override.yml b/src/docker-compose.override.yml index e8be593c..e3a748b9 100644 --- a/src/docker-compose.override.yml +++ b/src/docker-compose.override.yml @@ -1,15 +1,33 @@ services: - lumina-server: - container_name: lumina-server + lumina-api: + container_name: lumina-api build: context: . dockerfile: Lumina.Presentation.Api/Dockerfile environment: - ASPNETCORE_ENVIRONMENT=Development - ASPNETCORE_HTTP_PORTS=5214 + - ASPNETCORE_HTTPS_PORTS=7057 ports: - "5214:5214" + - "7057:7057" volumes: - ${APPDATA}/Microsoft/UserSecrets:/home/app/.microsoft/usersecrets:ro - ${APPDATA}/ASP.NET/Https:/home/app/.aspnet/https:ro - command: "dotnet /app/Lumina.Presentation.Api.dll" \ No newline at end of file + command: "dotnet /app/Lumina.Presentation.Api.dll" + lumina-web: + container_name: lumina-web + build: + context: . + dockerfile: Lumina.Presentation.Web/Dockerfile + environment: + - ASPNETCORE_ENVIRONMENT=Development + - ASPNETCORE_HTTP_PORTS=5012 + - ASPNETCORE_HTTPS_PORTS=7112 + ports: + - "5012:5012" + - "7112:7112" + volumes: + - ${APPDATA}/Microsoft/UserSecrets:/home/app/.microsoft/usersecrets:ro + - ${APPDATA}/ASP.NET/Https:/home/app/.aspnet/https:ro + command: "dotnet /app/Lumina.Presentation.Web.dll" diff --git a/src/docker-compose.vs.debug.yml b/src/docker-compose.vs.debug.yml index 341df4e3..45261a83 100644 --- a/src/docker-compose.vs.debug.yml +++ b/src/docker-compose.vs.debug.yml @@ -1,9 +1,15 @@ # this file is required because the default base output path for the projects has been changed, and we need to tell docker compose where to take the files from, in debug mode # this file is the last in the chain of files when docker-compose commands are called, so it always takes precedence services: - lumina-server: + lumina-api: labels: com.microsoft.visualstudio.debuggee.program: "/app/Lumina.Presentation.Api.dll" com.microsoft.visualstudio.debuggee.workingdirectory: "/app" volumes: - - ../bin/server/Debug/net8.0:/app \ No newline at end of file + - ../bin/api/Debug/net8.0:/app + lumina-web: + labels: + com.microsoft.visualstudio.debuggee.program: "/app/Lumina.Presentation.Web.dll" + com.microsoft.visualstudio.debuggee.workingdirectory: "/app" + volumes: + - ../bin/web/Debug/net8.0:/app diff --git a/src/docker-compose.yml b/src/docker-compose.yml index 12f8eaab..10d6ab87 100644 --- a/src/docker-compose.yml +++ b/src/docker-compose.yml @@ -1,7 +1,18 @@ services: - lumina-server: - container_name: lumina-server - image: ${DOCKER_REGISTRY-}lumina-server + lumina-api: + container_name: lumina-api + image: ${DOCKER_REGISTRY-}lumina-api build: context: . dockerfile: Lumina.Presentation.Api/Dockerfile + environment: + - LOG_PATH=/logs + + lumina-web: + container_name: lumina-web + image: ${DOCKER_REGISTRY-}lumina-web + build: + context: . + dockerfile: Lumina.Presentation.Web/Dockerfile + environment: + - LOG_PATH=/logs diff --git a/src/launchSettings.json b/src/launchSettings.json index 9de105e4..5ecb0e98 100644 --- a/src/launchSettings.json +++ b/src/launchSettings.json @@ -4,8 +4,9 @@ "commandName": "DockerCompose", "commandVersion": "1.0", "serviceActions": { - "lumina-server": "StartDebugging" + "lumina-api": "StartDebugging", + "lumina-web": "StartDebugging" } } } -} \ No newline at end of file +}