Giter Site home page Giter Site logo

fengweijp / docknetfiddle Goto Github PK

View Code? Open in Web Editor NEW

This project forked from danijg/docknetfiddle

0.0 2.0 0.0 532 KB

Code for the article published in the DotNetCurry magazine.

Home Page: http://www.dotnetcurry.com/windows-azure/1339/docknetfiddle-using-docker-dotnet-core

License: MIT License

C# 41.63% HTML 22.75% Smalltalk 21.94% Shell 7.11% JavaScript 5.27% CSS 1.29%

docknetfiddle's Introduction

DockNetFiddle

This repo contains the code for the article Building DockNetFiddle using Docker and .NET Core published in the DotNetCurry magazine.

It is the full source code of the proposed DockNetFiddle site, an ASP.Net Core application built with the aim of learning about docker and .Net Core.

DockNetFiddle is a simple site where users can enter minimum but complete .Net Core applications (providing the contents for the files program.cs and project.json ) which will be then executed inside a docker container. The results of the program execution will be send back and displayed to the users. In the end is a very simple version of the real .NetFiddle site.

The project uses 2 containers, one running the ASP.Net Core application and a separated one which will run the programs entered by the user.

VS2015 vs VS2017

The project was originaly built in VS2015 and used the "old" .Net Core project style based on the project.json file. Since then, VS2017 has been released and .Net Core has moved back to csproj and its XML based project file.

  • If you want to use VS2015, stay on the master branch. The site will let users write .Net Core console applications with a project.json file.
  • If you want to try VS2017, use the VS2017-csproj branch. The site will let users write .Net Core console applications with a project.csproj file.
  • If all you want to do is docker-compose up, you can try either branch :). The dockerfiles in master are locked to the old project.json base images while the dockerfiles in VS2017-csproj use the latest .net core images.

Instructions

  1. clone the repo in a new folder
  2. cd into src/DockNetFiddle
  3. run docker-compose up. This will generate the docker images and start new containers
  4. fire up a browser and open http://localhost:8080 (replace localhost with the ip of your docker host or docker VM if using docker toolbox in win7/8)
  5. the site home page should load: alt
  6. press Run to execute the code
  7. stop the containers with Ctrl+C (console will be attached to both containers, so you will need to press it twice)
  8. optionally remove the containers with docker-compose down

Running in the background

If you run docker-compose up your console gets attached to both containers (making the output hard to follow) and you will stop them if you stop the console.

You can also run them in the background and attach/detach the console when needed

  1. run docker-compose up -d
  2. attach to one of the containers with docker attach webapp or docker attach coderunner. You will see the output in your console (although coderunner will be in its infine loop without printing anything). Press Ctrl+C to detach and leave the container in the background.
  3. attach an interactive shell on one of the containers as in docker exec -it coderunner /bin/bash. You will be then in a new terminal inside that container. Enter exit when finished, the container will keep running in the background.
  4. stop and remove the containers with docker-compose down (Or manually send docker stop and docker rm commands)

docknetfiddle's People

Contributors

daniel-jimenezgarcia-ow avatar danijg avatar

Watchers

James Cloos avatar  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.