首页 > 其他分享 >NETCORE DockerFile

NETCORE DockerFile

时间:2023-10-20 18:14:06浏览次数:36  
标签:WORKDIR RUN tar NETCORE app dotnet COPY DockerFile

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

相关文章

  • React DockerFile 镜像部署
    1.配置Node.js运行环境(可以不用配置)   1>wget https://nodejs.org/dist/v12.18.1/node-v12.18.1-linux-x64.tar.gz   2>sudotar-zxvfnode-v12.18.1-linux-x64.tar.gz   3>cp-a/root/node-v12.18.1-linux-x64/bin/node/usr/local/bin/node  4......
  • Dockerfile语法
    一、dockerfile简介镜像是多层存储,每一层在前一层的基础上进行修改;容器也是多层存储,以镜像为基础层,在其基础上加一层作为容器运行时的存储层。创建镜像的两个方法:1.手动修改容器内容,然后dockercommit提交容器为新的镜像2.通过在dockerfile中定义一系列的命令和参数构成的......
  • docker入门加实战—Docker镜像和Dockerfile语法
    docker入门加实战—Docker镜像和Dockerfile语法镜像镜像就是包含了应用程序、程序运行的系统函数库、运行配置等文件的文件包。构建镜像的过程其实就是把上述文件打包的过程。镜像结构我们要从0部署一个Java应用,大概流程是这样:准备Linux运行环境(java项目并不需要完整的操作......
  • .netframework迁移到.netcore方法
    一.netframework程序迁移到.netcore5.0对于.netframwork程序想要升级为.netcore5.0的方法,微软官方也给出了方法见https://docs.microsoft.com/en-us/dotnet/desktop/winforms/migration/?view=netdesktop-5.0,我这里总结记录一下.1.首先要检查自己应用程序适不适合迁移.netfr......
  • Dockerfile 中的 CMD 与 ENTRYPOINT
    1、概述CMD和ENTRYPOINT指令都用于定义容器启动时执行的命令,单从功能上来看,这两个命令几乎是重复的,单独使用其中的一个就可以实现绝大多数的用例。尽管如此,它们在某些情况下具有不同的用途和优势。这篇文章旨在澄清它们的用法,以帮助你在实际应用中做出明智的选择,避免混淆。2......
  • NetCore Ocelot 之 Cache
    OcelotsupportssomeveryrudimentarycachingatthemomentproviderbytheCacheManagerproject.Thissanamazingprojectthatissolvingalotofcachingproblems.IwouldrecommendusingthispackagetocachewithOcelot.Thefollowingexampleshowsh......
  • NetCore Ocelot 之 Authorization
    Ocelotsupportsclaimsbasedauthorizationwhichisrunpostauthentication.ThismeansifouhavearouteyouwanttoauthorizeyoucanaddthefollowingtoyouRouteconfiguration."RouteClaimsRequirement":{"client_role":......
  • NetCore Ocelot 之 Qos
    QosqualityofserviceOcelotsupportsoneQoscapabilityatthecurrenttime.YoucansetonaperRoutebasisifyouwanttouseacircuitbreakerwhenmakingrequeststoadownstreamservice.Thisusesanawesome.NETlibrarycalledPolly.Thefirstthi......
  • NetCore Ocelot 之 Load Balancer
    OcelotcanloadbalanceacrossavailabledownstreamservicesforeachRoute.ThismeansyoucanscaleyourdownstreamservicesandOcelotcanusethemeffectively.TheTypeofloadbalanceravailbleare:  LeastConnection -trackswhichservicearedeal......
  • NetCore Ocelot 之 Authentication
    InordertoauthenticateRoutesandsubsequentlyuseanyofOcelot'sclaimsbasedfeaturessuchasauthorizationormodifyingtherequestwithvaluesfromthetoken.UsersmustregisterauthenticationservicesintheirStartup.csasusualbuttheypr......