修改提交Dockerfile
This commit is contained in:
parent
67992af570
commit
a4f03cfbc1
25
.dockerignore
Normal file
25
.dockerignore
Normal file
@ -0,0 +1,25 @@
|
||||
**/.dockerignore
|
||||
**/.env
|
||||
**/.git
|
||||
**/.gitignore
|
||||
**/.project
|
||||
**/.settings
|
||||
**/.toolstarget
|
||||
**/.vs
|
||||
**/.vscode
|
||||
**/.idea
|
||||
**/*.*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
|
||||
@ -1,21 +1,29 @@
|
||||
FROM mcr.microsoft.com/dotnet/aspnet:5.0 AS base
|
||||
#创建 /app文件夹
|
||||
FROM mcr.microsoft.com/dotnet/aspnet:7.0 AS base
|
||||
WORKDIR /app
|
||||
#创建挂载目录,用于将程序部署在服务器本地
|
||||
#VOLUME /app
|
||||
#设置docker容器对外暴露端口
|
||||
EXPOSE 8888
|
||||
VOLUME /app/logs
|
||||
#COPY bin/Release/net5.0/publish/ app/
|
||||
COPY . app/
|
||||
EXPOSE 80
|
||||
EXPOSE 443
|
||||
|
||||
#设置容器内的时区,如果不设置,默认时区是标准时间比北京时间晚8个小时
|
||||
RUN echo "Asia/shanghai" > /etc/timezone
|
||||
RUN cp /usr/share/zoneinfo/Asia/Shanghai /etc/localtime
|
||||
FROM mcr.microsoft.com/dotnet/sdk:7.0 AS build
|
||||
WORKDIR /src
|
||||
COPY ["ZR.Admin.WebApi/ZR.Admin.WebApi.csproj", "ZR.Admin.WebApi/"]
|
||||
COPY ["ZR.CodeGenerator/ZR.CodeGenerator.csproj", "ZR.CodeGenerator/"]
|
||||
COPY ["Infrastructure/ZR.Infrastructure.csproj", "Infrastructure/"]
|
||||
COPY ["ZR.Common/ZR.Common.csproj", "ZR.Common/"]
|
||||
COPY ["ZR.ServiceCore/ZR.ServiceCore.csproj", "ZR.ServiceCore/"]
|
||||
COPY ["ZR.Repository/ZR.Repository.csproj", "ZR.Repository/"]
|
||||
COPY ["ZR.Model/ZR.Model.csproj", "ZR.Model/"]
|
||||
COPY ["ZR.Service/ZR.Service.csproj", "ZR.Service/"]
|
||||
COPY ["ZR.Tasks/ZR.Tasks.csproj", "ZR.Tasks/"]
|
||||
COPY ["ZR.Admin.Grpc/ZR.Admin.Grpc.csproj", "ZR.Admin.Grpc/"]
|
||||
RUN dotnet restore "ZR.Admin.WebApi/ZR.Admin.WebApi.csproj"
|
||||
COPY . .
|
||||
WORKDIR "/src/ZR.Admin.WebApi"
|
||||
RUN dotnet build "ZR.Admin.WebApi.csproj" -c Release -o /app/build
|
||||
|
||||
# 复制发布文件到工作目录
|
||||
#COPY . app/
|
||||
FROM build AS publish
|
||||
RUN dotnet publish "ZR.Admin.WebApi.csproj" -c Release -o /app/publish /p:UseAppHost=false
|
||||
|
||||
FROM base AS final
|
||||
WORKDIR /app
|
||||
|
||||
#等价于 dotnet ZR.Admin.WebApi.dll,如果不指定启动端口默认在docker里面启动端口是80端口
|
||||
ENTRYPOINT ["dotnet", "ZR.Admin.WebApi.dll", "--server.urls","http://*:8888"]
|
||||
COPY --from=publish /app/publish .
|
||||
ENTRYPOINT ["dotnet", "ZR.Admin.WebApi.dll"]
|
||||
|
||||
@ -4,6 +4,7 @@
|
||||
<Nullable>enable</Nullable>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<GenerateDocumentationFile>true</GenerateDocumentationFile>
|
||||
<DockerDefaultTargetOS>Linux</DockerDefaultTargetOS>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
|
||||
<NoWarn>1701;1702;1591,8603,8602,8604,8600,8618</NoWarn>
|
||||
@ -29,6 +30,9 @@
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Content Include="..\.dockerignore">
|
||||
<Link>.dockerignore</Link>
|
||||
</Content>
|
||||
<None Update="ip2region.db">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</None>
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user