1.DockerFile配置
rm -rf Dockerfile cat>>Dockerfile<<EOF FROM mcr.microsoft.com/dotnet/aspnet:3.1 AS base # RUN apk add --no-cache icu-libs EXPOSE 80 EXPOSE 443 # build FROM mcr.microsoft.com/dotnet/sdk:3.1 AS build RUN dotnet nuget add source https://mirrors.yanwentech.com/repository/nuget-group/index.json -n nuget.yanwentech
RUN dotnet nuget disable source nuget.org WORKDIR /src COPY 项目目录/csproj文件 目标目录/ RUN dotnet restore "目标目录/csproj文件" # copy everything else and build app COPY . . WORKDIR "/src/项目名称" RUN dotnet publish -c release -o /app # final stage/image FROM base AS final WORKDIR /app COPY --from=build /app ./ ENV DOTNET_SYSTEM_GLOBALIZATION_INVARIANT=false ENTRYPOINT ["dotnet", "项目名称.dll"] EOF
2. netCore 运行环境 配置
wget https://download.visualstudio.microsoft.com/download/pr/e89c4f00-5cbb-4810-897d-f5300165ee60/027ace0fdcfb834ae0a13469f0b1a4c8/dotnet-sdk-3.1.426-linux-x64.tar.gz
mkdir dotnet
tar -zxf dotnet-sdk-3.1.426-linux-x64.tar.gz -C dotnet
cd /etc/profile.d
vim dotnet.sh
#!/bin/sh export DOTNET_ROOT=/usr/local/dotnet export PATH=$PATH:$DOTNET_ROOT
标签:WORKDIR,RUN,tar,NETCORE,app,dotnet,COPY,DockerFile From: https://www.cnblogs.com/cenwenlin/p/17777684.html