Working on C# docker dev env

master
Jason Zhu 2021-01-27 23:42:53 +11:00
parent d035c09888
commit 9f6e9adbc7
3 changed files with 25 additions and 4 deletions

View File

@ -5,3 +5,16 @@ This repository is a playground for practising docker based programming followin
* Topic 1: [Working with Dockerfiles (.NET, Golang, Python, NodeJS)](docs/working_with_dockerfiles.md)
* Topic 2: [Working with code (.NET, Golang, Python, NodeJS)](docs/working_with_code.md)
* Topic 3: [Multistage & Layers](docs/multistage_layers.md)
## Reference
VSCode official document contains many good information:
* [Developing inside a Container](https://code.visualstudio.com/docs/remote/containers)
* [devcontainer.json](https://code.visualstudio.com/docs/remote/devcontainerjson-reference) file used to tell VSCode how to access a development container
* [Tutorial: Remote development in Container](https://code.visualstudio.com/docs/remote/containers-tutorial)
* [ASP.NET Core in a container](https://code.visualstudio.com/docs/containers/quickstart-aspnet-core) describe how to create ASP.NET container from local environment (not recommended for docker-based development)
* [Container tips for docker development (like remote)](https://code.visualstudio.com/docs/remote/troubleshooting#_container-tips)
* [Adding extension to devcontainer.json](https://code.visualstudio.com/docs/remote/containers#_adding-an-extension-to-devcontainerjson)
Blogs with good Docker related information:
* [Code in a Container](https://nabeelvalley.netlify.app/blog/2020/25-07/developing-in-a-container-vscode/)

View File

@ -9,7 +9,15 @@ RUN dotnet restore
COPY ./src/ /app/
RUN mkdir /out/
RUN dotnet publish --no-restore --output /out/ --configuration Release
RUN dotnet publish --output /out/ --configuration Release
############# DEBUG IMAGE ################
FROM dev as debug
RUN apt-get update
RUN apt-get install -y unzip
RUN curl -sSL https://aka.ms/getvsdbgsh | /bin/sh /dev/stdin -v latest -l ~/vsdbg
RUN dotnet run
############## PRODUCT IMAGE #############
FROM mcr.microsoft.com/dotnet/core/sdk:2.2-stretch-slim as prod

View File

@ -1,11 +1,11 @@
version: "3"
version: "3.4"
services:
csharp:
container_name: csharp # image name
image: cruxlight/csharp_sdk:1.0.0
build:
context: ./c#
target: dev
target: debug
working_dir: /work
entrypoint: /bin/sh
stdin_open: true