mirror of
https://github.com/BinaryAlley/Nemera.git
synced 2026-12-03 18:21:10 +00:00
Adds docker support for the server API.
This commit is contained in:
1 parent
dfc7112cb7
commit
4a53348013
10 files changed
+178
-14
No files matched your search
@@ -0,0 +1,54 @@
|
||||
# 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 5214
|
||||
|
||||
# ==== 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.Api/Lumina.Presentation.Api.csproj", "Lumina.Presentation.Api/"]
|
||||
COPY ["Lumina.Application/Lumina.Application.csproj", "Lumina.Application/"]
|
||||
COPY ["Lumina.Domain/Lumina.Domain.csproj", "Lumina.Domain/"]
|
||||
COPY ["Lumina.Infrastructure/Lumina.Infrastructure.csproj", "Lumina.Infrastructure/"]
|
||||
COPY ["Lumina.DataAccess/Lumina.DataAccess.csproj", "Lumina.DataAccess/"]
|
||||
|
||||
RUN dotnet restore "./Lumina.Presentation.Api/Lumina.Presentation.Api.csproj" /p:BaseOutputPath=/app/publish/
|
||||
|
||||
# build the project
|
||||
COPY ["Lumina.Presentation.Api/", "Lumina.Presentation.Api/"]
|
||||
COPY ["Lumina.Application/", "Lumina.Application/"]
|
||||
COPY ["Lumina.Domain/", "Lumina.Domain/"]
|
||||
COPY ["Lumina.Infrastructure/", "Lumina.Infrastructure/"]
|
||||
COPY ["Lumina.DataAccess/", "Lumina.DataAccess/"]
|
||||
COPY . .
|
||||
WORKDIR /src/Lumina.Presentation.Api
|
||||
|
||||
RUN dotnet build "./Lumina.Presentation.Api.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.Api.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=5214
|
||||
EXPOSE 5214
|
||||
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 .
|
||||
@@ -3,9 +3,14 @@
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net8.0</TargetFramework>
|
||||
<Nullable>enable</Nullable>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<BaseOutputPath>..\..\bin\</BaseOutputPath>
|
||||
<ImplicitUsings>disable</ImplicitUsings>
|
||||
<BaseOutputPath>$(SolutionDir)..\bin\server\</BaseOutputPath>
|
||||
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
|
||||
<UserSecretsId>37d55c87-4374-4971-82e9-012fcaad1853</UserSecretsId>
|
||||
<DockerDefaultTargetOS>Linux</DockerDefaultTargetOS>
|
||||
<ContainerRepository>lumina-server</ContainerRepository>
|
||||
<DockerfileTag>lumina-server</DockerfileTag>
|
||||
<DockerComposeProjectPath>..\docker-compose.dcproj</DockerComposeProjectPath>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
@@ -24,6 +29,7 @@
|
||||
<PackageReference Include="Microsoft.AspNetCore.Mvc.Versioning" Version="5.1.0" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.Mvc.Versioning.ApiExplorer" Version="5.1.0" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.OpenApi" Version="8.0.8" />
|
||||
<PackageReference Include="Microsoft.VisualStudio.Azure.Containers.Tools.Targets" Version="1.21.0" />
|
||||
<PackageReference Include="Swashbuckle.AspNetCore" Version="6.7.3" />
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="8.0.8">
|
||||
<PrivateAssets>all</PrivateAssets>
|
||||
|
||||
@@ -1,25 +1,32 @@
|
||||
{
|
||||
"$schema": "http://json.schemastore.org/launchsettings.json",
|
||||
{
|
||||
"profiles": {
|
||||
"http": {
|
||||
"commandName": "Project",
|
||||
"dotnetRunMessages": true,
|
||||
"launchBrowser": false,
|
||||
"launchUrl": "swagger",
|
||||
"applicationUrl": "http://localhost:5214",
|
||||
"environmentVariables": {
|
||||
"ASPNETCORE_ENVIRONMENT": "Development"
|
||||
}
|
||||
},
|
||||
"dotnetRunMessages": true,
|
||||
"applicationUrl": "http://localhost:5214"
|
||||
},
|
||||
"https": {
|
||||
"commandName": "Project",
|
||||
"dotnetRunMessages": true,
|
||||
"launchBrowser": false,
|
||||
"launchUrl": "swagger",
|
||||
"applicationUrl": "https://localhost:7057;http://localhost:5214",
|
||||
"environmentVariables": {
|
||||
"ASPNETCORE_ENVIRONMENT": "Development"
|
||||
}
|
||||
},
|
||||
"dotnetRunMessages": true,
|
||||
"applicationUrl": "https://localhost:7057;http://localhost:5214"
|
||||
},
|
||||
"Container (Dockerfile)": {
|
||||
"commandName": "Docker",
|
||||
"launchUrl": "{Scheme}://{ServiceHost}:{ServicePort}",
|
||||
"environmentVariables": {
|
||||
"ASPNETCORE_HTTP_PORTS": "5214"
|
||||
},
|
||||
"publishAllPorts": true,
|
||||
"useSSL": true
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"$schema": "http://json.schemastore.org/launchsettings.json"
|
||||
}
|
||||
Reference in new issue
Block a user