Skip to content

Commit

Permalink
add docker support
Browse files Browse the repository at this point in the history
  • Loading branch information
drikqlis authored Feb 16, 2024
1 parent abe64d5 commit 8d84ceb
Show file tree
Hide file tree
Showing 4 changed files with 84 additions and 13 deletions.
30 changes: 30 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
**/.classpath
**/.dockerignore
**/.env
**/.git
**/.gitignore
**/.project
**/.settings
**/.toolstarget
**/.vs
**/.vscode
**/*.*proj.user
**/*.dbmdl
**/*.jfm
**/azds.yaml
**/bin
**/charts
**/docker-compose*
**/Dockerfile*
**/node_modules
**/npm-debug.log
**/obj
**/secrets.dev.yaml
**/values.dev.yaml
LICENSE
README.md
!**/.gitignore
!.git/HEAD
!.git/config
!.git/packed-refs
!.git/refs/heads/**
3 changes: 3 additions & 0 deletions DagoniteEmpire/DagoniteEmpire.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
<TargetFramework>net7.0</TargetFramework>
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
<UserSecretsId>9a3c55b2-09c2-4342-8905-6c957b9faa98</UserSecretsId>
<DockerDefaultTargetOS>Linux</DockerDefaultTargetOS>
</PropertyGroup>

<ItemGroup>
Expand All @@ -30,6 +32,7 @@
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="Microsoft.VisualStudio.Azure.Containers.Tools.Targets" Version="1.19.6" />
<PackageReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Design" Version="7.0.11" />
<PackageReference Include="Npgsql.EntityFrameworkCore.PostgreSQL" Version="7.0.11" />
<PackageReference Include="Syncfusion.Blazor.Grid" Version="24.2.3" />
Expand Down
26 changes: 26 additions & 0 deletions DagoniteEmpire/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
FROM mcr.microsoft.com/dotnet/aspnet:7.0 AS base
WORKDIR /app
EXPOSE 80
EXPOSE 443

FROM mcr.microsoft.com/dotnet/sdk:7.0 AS build
ARG BUILD_CONFIGURATION=Release
WORKDIR /src
COPY ["DagoniteEmpire/DagoniteEmpire.csproj", "DagoniteEmpire/"]
COPY ["DA_Business/DA_Business.csproj", "DA_Business/"]
COPY ["DA_Models/DA_Models.csproj", "DA_Models/"]
COPY ["DA_DataAccess/DA_DataAccess.csproj", "DA_DataAccess/"]
COPY ["DA_Common/DA_Common.csproj", "DA_Common/"]
RUN dotnet restore "./DagoniteEmpire/DagoniteEmpire.csproj"
COPY . .
WORKDIR "/src/DagoniteEmpire"
RUN dotnet build "./DagoniteEmpire.csproj" -c $BUILD_CONFIGURATION -o /app/build

FROM build AS publish
ARG BUILD_CONFIGURATION=Release
RUN dotnet publish "./DagoniteEmpire.csproj" -c $BUILD_CONFIGURATION -o /app/publish /p:UseAppHost=false

FROM base AS final
WORKDIR /app
COPY --from=publish /app/publish .
ENTRYPOINT ["dotnet", "DagoniteEmpire.dll"]
38 changes: 25 additions & 13 deletions DagoniteEmpire/Properties/launchSettings.json
Original file line number Diff line number Diff line change
@@ -1,35 +1,47 @@
{
"iisSettings": {
"iisExpress": {
"applicationUrl": "http://localhost:10743",
"sslPort": 44393
}
},
"profiles": {
"http": {
"commandName": "Project",
"dotnetRunMessages": true,
"launchBrowser": true,
"applicationUrl": "http://localhost:5093",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
},
"dotnetRunMessages": true,
"applicationUrl": "http://localhost:5093"
},
"https": {
"commandName": "Project",
"dotnetRunMessages": true,
"launchBrowser": true,
"applicationUrl": "https://localhost:7282;http://localhost:5093",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
},
"dotnetRunMessages": true,
"applicationUrl": "https://localhost:7282;http://localhost:5093"
},
"IIS Express": {
"commandName": "IISExpress",
"launchBrowser": true,
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
},
"Container (Dockerfile)": {
"commandName": "Docker",
"launchBrowser": true,
"launchUrl": "{Scheme}://{ServiceHost}:{ServicePort}",
"environmentVariables": {
"ASPNETCORE_URLS": "https://+:443;http://+:80"
},
"publishAllPorts": true,
"useSSL": true
}
},
"iisSettings": {
"windowsAuthentication": false,
"anonymousAuthentication": true,
"iisExpress": {
"applicationUrl": "http://localhost:10743",
"sslPort": 44393
}
}
}
}

0 comments on commit 8d84ceb

Please sign in to comment.