https://github.com/alextanhongpin/dotnetcore-docker
.NET Core 2 with Docker
https://github.com/alextanhongpin/dotnetcore-docker
docker dotnetcore2
Last synced: about 1 month ago
JSON representation
.NET Core 2 with Docker
- Host: GitHub
- URL: https://github.com/alextanhongpin/dotnetcore-docker
- Owner: alextanhongpin
- Created: 2018-01-23T02:31:27.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2018-01-23T02:31:44.000Z (over 8 years ago)
- Last Synced: 2025-01-29T21:54:22.378Z (over 1 year ago)
- Topics: docker, dotnetcore2
- Language: C#
- Size: 1000 Bytes
- Stars: 0
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Microservices with .NET Core 2
## Init
```bash
# Create a new app in the current directory
$ dotnet new console
# Create a new app in the folder myApp
$ dotnet new console -o myApp
```
## Publish
```bash
$ dotnet publish -o app
```
## Restore
```bash
$ dotnet restore
```
## Dockerize
Create a `.dockerignore`:
```
bin\
obj\
```
```Dockerfile
FROM microsoft/apsnetcore-build:2.0 AS build-env
WORKDIR /app
# Copy csproj and restore as distinct layers
COPY *.csproj ./
RUN dotnet restore
# Copy everything else and build
COPY . ./
RUN dotnet publish -c Release -o out
# Build runtime image
FROM microsoft/aspnetcore:2.0
WORKDIR /app
COPY --from=build-env /app/out .
ENTRYPOINT ["dotnet", "microservice.dll"]
```