Skip to content

Commit 925b88e

Browse files
committed
[增加]1. 增加Dockerfile
1 parent a45deef commit 925b88e

File tree

3 files changed

+69
-16
lines changed

3 files changed

+69
-16
lines changed

.dockerignore

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
**/.dockerignore
2+
**/.env
3+
**/.git
4+
**/.gitignore
5+
**/.project
6+
**/.settings
7+
**/.toolstarget
8+
**/.vs
9+
**/.vscode
10+
**/.idea
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

ProtoExport/Dockerfile

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
FROM mcr.microsoft.com/dotnet/runtime:8.0 AS base
2+
USER $APP_UID
3+
WORKDIR /app
4+
5+
FROM mcr.microsoft.com/dotnet/sdk:8.0 AS build
6+
ARG BUILD_CONFIGURATION=Release
7+
WORKDIR /src
8+
COPY ["ProtoExport/ProtoExport.csproj", "ProtoExport/"]
9+
RUN dotnet restore "ProtoExport/ProtoExport.csproj"
10+
COPY . .
11+
WORKDIR "/src/ProtoExport"
12+
RUN dotnet build "ProtoExport.csproj" -c $BUILD_CONFIGURATION -o /app/build
13+
14+
FROM build AS publish
15+
ARG BUILD_CONFIGURATION=Release
16+
RUN dotnet publish "ProtoExport.csproj" -c $BUILD_CONFIGURATION -o /app/publish /p:UseAppHost=false
17+
18+
FROM base AS final
19+
WORKDIR /app
20+
COPY --from=publish /app/publish .
21+
ENTRYPOINT ["dotnet", "ProtoExport.dll"]

ProtoExport/ProtoExport.csproj

Lines changed: 23 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,23 @@
1-
<Project Sdk="Microsoft.NET.Sdk">
2-
3-
<PropertyGroup>
4-
<OutputType>Exe</OutputType>
5-
<ImplicitUsings>enable</ImplicitUsings>
6-
<Nullable>disable</Nullable>
7-
<RootNamespace>GameFrameX.ProtoExport</RootNamespace>
8-
<TargetFramework>net8.0</TargetFramework>
9-
10-
</PropertyGroup>
11-
12-
<ItemGroup>
13-
<PackageReference Include="CommandLineParser" Version="2.9.1" />
14-
</ItemGroup>
15-
16-
</Project>
1+
<Project Sdk="Microsoft.NET.Sdk">
2+
3+
<PropertyGroup>
4+
<OutputType>Exe</OutputType>
5+
<ImplicitUsings>enable</ImplicitUsings>
6+
<Nullable>disable</Nullable>
7+
<RootNamespace>GameFrameX.ProtoExport</RootNamespace>
8+
<TargetFramework>net8.0</TargetFramework>
9+
<DockerDefaultTargetOS>Linux</DockerDefaultTargetOS>
10+
11+
</PropertyGroup>
12+
13+
<ItemGroup>
14+
<PackageReference Include="CommandLineParser" Version="2.9.1" />
15+
</ItemGroup>
16+
17+
<ItemGroup>
18+
<Content Include="..\.dockerignore">
19+
<Link>.dockerignore</Link>
20+
</Content>
21+
</ItemGroup>
22+
23+
</Project>

0 commit comments

Comments
 (0)