Skip to content

Commit 53828bd

Browse files
committed
Docker support added.
1 parent 55cabdf commit 53828bd

File tree

5 files changed

+62
-1
lines changed

5 files changed

+62
-1
lines changed

.dockerignore

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
**/.classpath
2+
**/.dockerignore
3+
**/.env
4+
**/.git
5+
**/.gitignore
6+
**/.project
7+
**/.settings
8+
**/.toolstarget
9+
**/.vs
10+
**/.vscode
11+
**/*.*proj.user
12+
**/*.dbmdl
13+
**/*.jfm
14+
**/azds.yaml
15+
**/bin
16+
**/charts
17+
**/docker-compose*
18+
**/Dockerfile*
19+
**/node_modules
20+
**/npm-debug.log
21+
**/obj
22+
**/secrets.dev.yaml
23+
**/values.dev.yaml
24+
LICENSE
25+
README.md

src/Apps/WebApi/Dockerfile

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
#See https://aka.ms/containerfastmode to understand how Visual Studio uses this Dockerfile to build your images for faster debugging.
2+
3+
FROM mcr.microsoft.com/dotnet/core/aspnet:3.1-buster-slim AS base
4+
WORKDIR /app
5+
EXPOSE 80
6+
EXPOSE 443
7+
8+
FROM mcr.microsoft.com/dotnet/core/sdk:3.1-buster AS build
9+
WORKDIR /src
10+
COPY ["src/Apps/WebApi/WebApi.csproj", "src/Apps/WebApi/"]
11+
COPY ["src/Common/Infrastructure/Infrastructure.csproj", "src/Common/Infrastructure/"]
12+
COPY ["src/Common/Application/Application.csproj", "src/Common/Application/"]
13+
COPY ["src/Common/Domain/Domain.csproj", "src/Common/Domain/"]
14+
RUN dotnet restore "src/Apps/WebApi/WebApi.csproj"
15+
COPY . .
16+
WORKDIR "/src/src/Apps/WebApi"
17+
RUN dotnet build "WebApi.csproj" -c Release -o /app/build
18+
19+
FROM build AS publish
20+
RUN dotnet publish "WebApi.csproj" -c Release -o /app/publish
21+
22+
FROM base AS final
23+
WORKDIR /app
24+
COPY --from=publish /app/publish .
25+
ENTRYPOINT ["dotnet", "WebApi.dll"]

src/Apps/WebApi/Properties/launchSettings.json

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,13 @@
2525
"ASPNETCORE_ENVIRONMENT": "Development"
2626
},
2727
"applicationUrl": "https://localhost:5001;http://localhost:5000"
28+
},
29+
"Docker": {
30+
"commandName": "Docker",
31+
"launchBrowser": true,
32+
"launchUrl": "{Scheme}://{ServiceHost}:{ServicePort}/api",
33+
"publishAllPorts": true,
34+
"useSSL": true
2835
}
2936
}
3037
}

src/Apps/WebApi/WebApi.csproj

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@
22

33
<PropertyGroup>
44
<TargetFramework>netcoreapp3.1</TargetFramework>
5+
<UserSecretsId>1387fd0c-7d61-4e8e-bed2-151aa37fac28</UserSecretsId>
6+
<DockerDefaultTargetOS>Linux</DockerDefaultTargetOS>
7+
<DockerfileContext>..\..\..</DockerfileContext>
58
</PropertyGroup>
69

710
<ItemGroup>
@@ -15,6 +18,7 @@
1518
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
1619
</PackageReference>
1720
<PackageReference Include="Microsoft.Extensions.Diagnostics.HealthChecks.EntityFrameworkCore" Version="3.1.9" />
21+
<PackageReference Include="Microsoft.VisualStudio.Azure.Containers.Tools.Targets" Version="1.10.9" />
1822
<PackageReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Design" Version="3.1.4" />
1923
<PackageReference Include="NSwag.AspNetCore" Version="13.8.2" />
2024
<PackageReference Include="NSwag.MSBuild" Version="13.8.2">

src/Common/Infrastructure/Infrastructure.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
</PropertyGroup>
66

77
<ItemGroup>
8-
<PackageReference Include="CsvHelper" Version="15.0.8" />
8+
<PackageReference Include="CsvHelper" Version="15.0.9" />
99
<PackageReference Include="Microsoft.AspNetCore.ApiAuthorization.IdentityServer" Version="3.1.9" />
1010
<PackageReference Include="Microsoft.AspNetCore.Diagnostics.EntityFrameworkCore" Version="3.1.9" />
1111
<PackageReference Include="Microsoft.AspNetCore.Identity.EntityFrameworkCore" Version="3.1.9" />

0 commit comments

Comments
 (0)