Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/brthor/Dockerize.NET
.NET Cli Tool to package your .NET Core Application into a docker image: 'dotnet dockerize'
https://github.com/brthor/Dockerize.NET
asp-net-core docker netcore netcoreapp
Last synced: about 2 months ago
JSON representation
.NET Cli Tool to package your .NET Core Application into a docker image: 'dotnet dockerize'
- Host: GitHub
- URL: https://github.com/brthor/Dockerize.NET
- Owner: brthor
- License: mit
- Created: 2017-10-28T06:17:45.000Z (almost 7 years ago)
- Default Branch: master
- Last Pushed: 2022-12-07T18:28:42.000Z (almost 2 years ago)
- Last Synced: 2024-06-21T18:08:25.101Z (3 months ago)
- Topics: asp-net-core, docker, netcore, netcoreapp
- Language: C#
- Homepage:
- Size: 31.3 KB
- Stars: 174
- Watchers: 17
- Forks: 8
- Open Issues: 5
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome - Dockerize.NET - .NET Cli Tool to package your .NET Core Application into a docker image: 'dotnet dockerize' (C# #)
- awesome-dotnet-core - Dockerize.NET - .NET Cli Tool to package your .NET Core Application into a docker image: 'dotnet dockerize' (Frameworks, Libraries and Tools / Build Automation)
- awesome-dotnet-core - Dockerize.NET - .NET Cli工具,用于将.NET Core应用程序打包到Docker映像中:“ dotnet dockerize” (框架, 库和工具 / 自动部署)
- fucking-awesome-dotnet-core - Dockerize.NET - .NET Cli Tool to package your .NET Core Application into a docker image: 'dotnet dockerize' (Frameworks, Libraries and Tools / Build Automation)
- awesome-dotnet-core - Dockerize.NET - .NET Cli Tool to package your .NET Core Application into a docker image: 'dotnet dockerize' (Frameworks, Libraries and Tools / Build Automation)
README
# Dockerize.NET: Your .NET Core App to a docker image
[![Build Status](https://travis-ci.org/brthor/Dockerize.NET.svg?branch=master)](https://travis-ci.org/brthor/Dockerize.NET)
[![Nuget Version Number](https://img.shields.io/nuget/v/Brthor.Dockerize.NET.svg)](https://www.nuget.org/packages/Brthor.Dockerize.NET)`dotnet dockerize -t brthor/serviceWorker:dev`
This is a simple dotnet cli tool that enables you to easily package your dotnet app into a docker container. The above invocation creates a docker image with the tag `brthor/serviceWorker:dev` which you can then `docker push` to your registry or `docker run` locally.
The image simply runs the `static void Main(string[] args)` or other entrypoint of your app.
This has many uses:
- Getting a service image ready for kubernetes environment
- Testing your application in different OS's available in docker
- Isolated environments for your app.
## Installation
It's easy, add the following to your `*.csproj` file:
```XML
```Then `dotnet restore`, followed by `dotnet dockerize` to make your docker image. The default tag is the project name.
## Options
See `dotnet dockerize -h` for available options.
```
$ dotnet dockerize -hUsage: [options]
Options:
-t |--tag The desired tag name of the created image. Will be directly passed to docker build -t, see docker build --help for more info. Defaults to the project name.-r |--runtime The RID of the specified Base Docker image. Defaults to "linux-x64".
-i |--image The base docker image used for the generated docker file. If you change this from the default, be sure toupdate BaseRid if appropriate. Defaults to "microsoft/dotnet:2.0-runtime".
-? | -h | --help Show help information
```## Example
```bash
$ mkdir newApp
$ cd newApp
$ dotnet new console
The template "Console Application" was created successfully.... etc output...
```
At this point you need to edit `newApp.csproj` and add the tool reference from above, and the whole file will look like:
```XML
Exe
netcoreapp2.0
```
Continuing on the command line:
```bash
$ dotnet dockerize
Dockerize Config
Base Docker Image: microsoft/dotnet:2.0-runtime
Base Rid of Docker Image: linux-x64
Tag: newApp... etc output...
$ docker run -it newApp
Hello World!
```## Contributing
There's a lot of room for improvement, especially with customization of the underlying dockerfile.
Feel free to create pull requests for additional features.