Skip to content

Commit 46ba550

Browse files
committed
添加docker支持
1 parent d5f8490 commit 46ba550

File tree

4 files changed

+76
-12
lines changed

4 files changed

+76
-12
lines changed

.Net6版本/.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

.Net6版本/VOL.WebApi/Dockerfile

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
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/aspnet:6.0 AS base
4+
RUN apt-get update; apt-get install libfontconfig1 -y
5+
6+
WORKDIR /app
7+
EXPOSE 9991
8+
9+
FROM mcr.microsoft.com/dotnet/sdk:6.0 AS build
10+
WORKDIR /src
11+
COPY ["VOL.WebApi/VOL.WebApi.csproj", "VOL.WebApi/"]
12+
COPY ["VOL.System/VOL.System.csproj", "VOL.System/"]
13+
COPY ["VOL.Core/VOL.Core.csproj", "VOL.Core/"]
14+
COPY ["VOL.Entity/VOL.Entity.csproj", "VOL.Entity/"]
15+
COPY ["VOL.Order/VOL.Order.csproj", "VOL.Order/"]
16+
COPY ["VOL.AppManager/VOL.AppManager.csproj", "VOL.AppManager/"]
17+
COPY ["VOL.Builder/VOL.Builder.csproj", "VOL.Builder/"]
18+
RUN dotnet restore "VOL.WebApi/VOL.WebApi.csproj"
19+
COPY . .
20+
WORKDIR "/src/VOL.WebApi"
21+
RUN dotnet build "VOL.WebApi.csproj" -c Release -o /app/build
22+
23+
FROM build AS publish
24+
RUN dotnet publish "VOL.WebApi.csproj" -c Release -o /app/publish
25+
26+
FROM base AS final
27+
WORKDIR /app
28+
COPY --from=publish /app/publish .
29+
ENTRYPOINT ["dotnet", "VOL.WebApi.dll"]
Lines changed: 19 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,4 @@
1-
{
2-
"iisSettings": {
3-
"windowsAuthentication": false,
4-
"anonymousAuthentication": true,
5-
"iisExpress": {
6-
"applicationUrl": "http://localhost:1309",
7-
"sslPort": 44318
8-
}
9-
},
1+
{
102
"profiles": {
113
"IIS Express": {
124
"commandName": "IISExpress",
@@ -18,10 +10,25 @@
1810
"VOL.WebApi": {
1911
"commandName": "Project",
2012
"launchBrowser": true,
21-
"applicationUrl": "https://localhost:5001;http://localhost:5000",
2213
"environmentVariables": {
2314
"ASPNETCORE_ENVIRONMENT": "Development"
24-
}
15+
},
16+
"applicationUrl": "http://localhost:9991"
17+
},
18+
"Docker": {
19+
"commandName": "Docker",
20+
"launchBrowser": true,
21+
"launchUrl": "{Scheme}://{ServiceHost}:{ServicePort}",
22+
"publishAllPorts": true,
23+
"useSSL": true
24+
}
25+
},
26+
"iisSettings": {
27+
"windowsAuthentication": false,
28+
"anonymousAuthentication": true,
29+
"iisExpress": {
30+
"applicationUrl": "http://localhost:1309",
31+
"sslPort": 44318
2532
}
2633
}
27-
}
34+
}

.Net6版本/VOL.WebApi/VOL.WebApi.csproj

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33
<PropertyGroup>
44
<TargetFramework>net6.0</TargetFramework>
55
<Nullable>enable</Nullable>
6+
<UserSecretsId>a3e3c6fb-4b7e-44a6-8dbe-5e5f11af4202</UserSecretsId>
7+
<DockerDefaultTargetOS>Linux</DockerDefaultTargetOS>
68
</PropertyGroup>
79

810
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
@@ -20,6 +22,7 @@
2022
<ItemGroup>
2123
<PackageReference Include="Autofac.Extensions.DependencyInjection" Version="6.0.0" />
2224
<PackageReference Include="Microsoft.AspNetCore.Authentication.JwtBearer" Version="6.0.0" />
25+
<PackageReference Include="Microsoft.VisualStudio.Azure.Containers.Tools.Targets" Version="1.15.1" />
2326
<PackageReference Include="Swashbuckle.AspNetCore" Version="6.0.0" />
2427
</ItemGroup>
2528

0 commit comments

Comments
 (0)