当前位置: 首页 > 软件库 > 云计算 > >

aspnet-docker

授权协议 Apache-2.0 License
开发语言 Java
所属分类 云计算
软件类型 开源软件
地区 不详
投 递 者 艾焱
操作系统 跨平台
开源组织
适用人群 未知
 软件概览

Docker images for ASP.NET Core apps on Google Cloud

This repo containes the definition of the Docker images for the .NET runtime to be able to run ASP.NET Core apps on App Engine Flexible environment as well as the runtime builder which will generate the necessary Dockerfile to build ASP.NET Core apps pushed to App Engine Flex.

The repo is divided in two main directories:

  • The runtimes directory contains the definition for all of .NET Core runtimes targeting the major versions of .NET Core.
  • The builder directory contains the definition for the runtime builder image.

The runtimes

The runtimes directory contains definition for the .NET Core runtime images for each major version. The cloudbuild.yaml file defines the build process for the images. To build the images you run the following code from the root of the repo.

./tools/submit_build.sh ./runtimes/cloudbuild.yaml

This will build all of the runtimes for .NET Core. Tests will run during the build to ensure that the images have the right contents and that the images are functional.

The runtime builder

The builder directory contains the definition for the builder image for the aspnetcore runtime for Google App Engine Flexible environment. This builder image is responsible for generating a Dockerfile for a given published .NET Core application. This Dockerfile is then used during the deployment process to generate the app's image that will ultimately run in Google App Engine Flexible environment.

Using the images to deploy ASP.NET Core apps

Theses images are designed and tested to run apps on App Engine Flexible environment but it can also be used to run .NET Core apps on other Docker hosts such as Kubernetes Engine or just plain Docker.

Each image is designed to run self-contained .NET Core apps, which means that the app must be published before you can build the app's image. To publish the app run the following command at the root of your app's project:

dotnet publish -c Release

This will produce a directory with the app's code and all its dependencies. For a .NET Core 2.0 app this directory will be under bin/release/netcoreapp2.0/publish/; This is the directory where the Dockerfile for app's image should be placed.

Using the runtime image in App Engine Flex

Typically you won't need to produce a Dockerfile when deploying ASP.NET Core apps to App Engine Flex, the deployment process will generate one for you when you specify the aspnetcore runtime in your app.yaml file. The minimal app.yaml file looks like this:

runtime: aspnetcore
env: flex

Typically you will have the app.yaml in the root of your project, we recommend that you add the app.yaml to your .csproj file with a line like this:

<None Include="app.yaml" CopyToOutputDirectory="Always" />

This will ensure that the file app.yaml is published with the rest of the app. To deploy you will run the comand (assuming you are running from the project's root):

gcloud beta app deploy ./bin/release/netcoreapp1.0/publish/app.yaml

The deployment process will automatically use the runtime builder, which will detect what version of .NET Core you are using and produce the appropriate Dockerfile for your app.

Using the runtime image in other environments

The runtime image can be used as the base image for an ASP.NET Core apps and run in other environments such as Google Kubernetes Engine (GKE) and any other Docker host.

To create a Docker image for your app create a Dockerfile that looks like this:

FROM gcr.io/google-appengine/aspnetcore:2.0
ADD ./ /app
ENV ASPNETCORE_URLS=http://*:${PORT}
WORKDIR /app
ENTRYPOINT [ "dotnet", "<dll_name>.dll" ]

Replace the <dll_name> with the name of the entrypoing .dll in your project, that should start your app listening on port 8080.

We recommend that you store the Dockerfile on the root of your project and you add it to your .csproj so it is published with the rest of the app. You can add the Dockerfile with a line like this:

<None Include="Dockerfile" CopyToOutputDirectory="Always" />

Support

To get help on using the aspnet runtime, please log an issue in this repo

Patches are encouraged, and may be submitted by forking this project and submitting a Pull Request. See CONTRIBUTING.md for more information.

License

Apache 2.0. See LICENSE for more information.

 相关资料
  • etec-aspnet-exercises Exercícios de ASP.NET do meu curso na ETEC Exercícios Todos os exercícios estão disponíveis no diretório exercises/.

  • aspnet-core-webapi Esse é um projeto para futuras consultas de técnicas empregadas com ASP.NET Core 2.2 aplicando API-Guidelines da Microsoft. Técnicas RESTfull Autenticação JWT Swagger Versionamento

  • Getting Started If you don't have Docker, download it from the address below. https://www.docker.com/products/docker-desktop Download this repository Open onion-architecture.sln with Visual studio Con

  • aspnet-distributed-caching Sample repo to demo an ASP.NET Core 3.1 website distributedcaching with Docker, MongoDB, Redis using Docker Compose. This is a sample application to demo Microservices in .N

  • aspnet-async-communication Undoubtedly the most popular design pattern when writing distributed applicationis Pub/Sub. Turns out that there's another important design pattern used indistributed applic

  • 8.3 ABP实时服务 - 集成Abp.AspNetCore.SignalR 8.3.1 简介 在基于ABP开发的应用中,为了更简单的使用ASP.NET Core SignalR,您可以 使用Abp.AspNetCore.SignalR 包。 注意:该软件包目前是 preview。如果您遇到问题,请提交issues给Github:https://github.com/aspnetboilerpla