The Docker Job
We'll cover the following
Before diving into the docker job to run this specific application, have a look at the job feature here.
The Docker job to run the application is as follows:
Here are the contents of the above written Docker job in text:
Job Name: ASP.NET
InputFileName: foo
Run Script: echo 10
Run in Live Container: true
Application Port: 5001
HTTPS Strict Mode: false
Force Relaunch On Widget Switch: false
Start Script: cd /usercode/AspMVC/ && dotnet watch run --urls=http://0.0.0.0:5001/
Don’t worry if the above image looks overwhelming. We will have a look at it step by step.
Starting from Job Name field, I named the job name “ASP.NET”. You can name your job whatever you want. Secondly, the input file name is a dummy field for LiveVM so I have entered “foo” in that field.
Start Script
The Start Script
is used to run the application server.
Lets breakdown the commands in Start Script.
# This command is used to move into the AspMVC folder that contains the app# The code in a SPA editor resides in the usercode directory# Since our project is 'AspMVC', the path will be /usercode/AspMVCcd /usercode/AspMVC/# This command is used to run the application serverdotnet watch run# This command is used to make the server listen on the custom ip and port.# This overrides the configration given in the application!# ip = 0.0.0.0 is used instead of 'localhost' on Educative# 5001 is the port selected, however any allowed port can be used--urls=http://0.0.0.0:5001/
Run Script
The run script is as follows:
echo 10
The above script basically runs the code every time the Run button is clicked, but we cannot see its contents in the terminal.
In our case, we do not need anything significant to happen each time a user presses run. All we had to do was start the server in the Start Script.
Any changes in the code made by the user will be automatically detected and rendered on pressing Run. Hence, we have just put an echo
command here.
The Watcher
In order to reflect the changes that the user makes in the live editor, a watcher is used. For ASP.NET the built-in watcher can be started along with the application server using dotnet watch run
command.
The application port that needs to be opened should be specified in the Application Port
field.
You have learned everything to set up the ASP.NET environment on Educative! In the next lesson, you will learn how to configure the front-end of the application editor that the user will face.