GithubHelp home page GithubHelp logo

muskanmahajan37 / aspnet-docker Goto Github PK

View Code? Open in Web Editor NEW

This project forked from googlecloudplatform/aspnet-docker

0.0 0.0 0.0 33.12 MB

License: Apache License 2.0

Python 16.17% C# 24.57% Shell 37.86% Dockerfile 20.12% NASL 1.28%

aspnet-docker's Introduction

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.

aspnet-docker's People

Contributors

bendory avatar dlorenc avatar donmccasland avatar iantalarico avatar ivannaranjo avatar jeadorf avatar jskeet avatar nkubala avatar sharifelgamal avatar tstromberg avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.