Git Product home page Git Product logo

generator-docker's Introduction

Important

The list of tools described below are archived and no longer under development. For the latest versions of the container tooling for Visual Studio and Visual Studio Code, please see Containers Tools in Visual Studio and the Visual Studio Code Docker extension

Generator-docker (archived)

Package version CI Status Downloads

This generator creates a Dockerfile and scripts (dockerTask.sh and dockerTask.ps1) that helps you build and run your project inside of a Docker container. The following project types are currently supported:

  • .NET Core
  • Node.js
  • Go

Quick demo

nodejs-demo

Longer walkthrough video

See the generator in action]

Installing

Prerequisites:

Install the Docker generator:

npm install -g generator-docker

Getting Started

Once yo docker and VS Code are installed, here's the few steps to debug your first app

Node.js

  • From the root of your project, where your server.js file exists, open a bash or powershell window
yo docker
  • Answer the prompts, including your image name
  • Open the file you wish to debug and set a breakpoint
  • From VS Code, open the command palette (Mac: [⌘] + [P], Windows: [CTRL] + [P])
  • Enter: task composeForDebug This will compose your containers using the dockerTask.sh script
  • [F5] to start the node debugger within the container
  • As we use nodemon -L --debug-brk, the debugger will break on the first line of your main file, so that you can debug the initialization of your app

DotNet Core

  • From the root of your project open a bash or powershell window
yo docker
  • Answer the prompts, including your image name
  • Open the file you wish to debug and set a breakpoint
  • [F5] to start the .NET Core debugger within the container

Contributing

See Contributing for guidelines

Q&A

  • Q: Are you building an abstraction layer over docker apis?
    • A: No. These are your scripts. We're simply providing a starting point that docker developers would write themselves. These scripts are based on customers we've been working with.
  • Q: Are you taking feedback?

Version History

###v0.0.36

  • Removed Application Insights telemetry

###v0.0.35

  • Added support for .Net Core Console Apps.
  • Updated Docker for Windows beta address to http://localhost
  • BugFix: Special characters in project names are now ignored.

###v0.0.34

  • Switch to using docker-compose for build.
  • BugFix: Add usage of ASPNETCORE_URLS Environment variable to support urls other than localhost for .NET Core.

###v0.0.33

  • Added support for .Net Core RTM.

###v0.0.32

  • Added integrated debugging using [F5] for both Node.js and .NET Core.
  • Changed to always generate bash and PowerShell scripts to enable cross-platform development.
  • Changed compose file to use the image created by build (introduced a tag to disambiguate debug and release image).
  • Removed usage of docker-machine in favor of defaults for Docker for Windows and Docker for Mac.

###v0.0.31

  • Added support for ASP.Net Core 5 RC2.
  • BigFix: Optimized the creation of the node image to take advantage of caching.

###v0.0.29

  • Fix for issue #34 (Update ASP.NET dockerfile and add support for RC).

###v0.0.27

  • Replaced .CMD file with PowerShell script.
  • Adding .debug and .release compose files.
  • Replaced ADD command with COPY command in dockerfile.

###v0.0.26

  • BugFix: fixing issues with the path on Windows when using volume sharing in Node.js projects.

###v0.0.25

  • BugFix: making sure config is defined before reading a property.
  • BugFix: tracking if users opted-in or out for data collection.

###v0.0.24

  • Docker-compose.yml files are being created now for all project types.

License

See LICENSE for full license text.

generator-docker's People

Contributors

dbreshears avatar divinebovine avatar fatihboy avatar floydpink avatar msftgits avatar ncarlsonmsft avatar peterblazejewicz avatar saurabsa avatar stevelas avatar stevelasker avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

generator-docker's Issues

Switch to .NET RTM

Release the RTM version of .NET Core
Remove references to RC2 and RC1

Description Video Tutorial(Valid?) - Generator different, commands different, outcomes different.

YouTube Tutorial

When I follow the tutorial given in the description of this repository... Everything seems pretty much the same for the most part. When I get to the part where the tutorial does ./dockerTask.sh, this does not work for me I can only get it to work if I add build to the end of it like ./dockerTask.sh build. It does successfully build the image, does not run the container automatically like shown in the tutorial and if I try to create one myself, I cannot get the container to stay running.

So is the tutorial still valid and helpful if things have changed to the point where it's not showing me what to do anymore?

Don't get me wrong I really appreciate all the help and the tutorial. Just trying to learn.

Update to use docker beta and Linux

Docker beta does not require docker-machine. The current script depends on docker-machine. Please add this as an option, or maybe fallback when docker-machine answers with No active host found to docker-machine active.
With docker beta, the host will be available as docker, for example http://docker.

Another important use case is for linux users, which also don't need docker-machine, and also will not use docker beta. In this case, we should detect the OS, and if it is a linux machine, and docker-machine active reports no host found, parse the $DOCKER_HOST variable, or, if it does not exist, assume localhost.

Can't read project.json with generator-aspnet and generator-docker

When I try to create a default asp.net web application with docker I use generator-aspnet and generator-docker and the generation fails because generator-docker expects a project.json file.

These are the versions of my software.

node v6.10.0
npm 4.3.0
[email protected]
[email protected]
windows 10

C:\projects\Reference Applications\asp_net_docker> yo aspnet

 _-----_     ╭──────────────────────────╮
|       |    │      Welcome to the      │
|--(o)--|    │  marvellous ASP.NET Core │

---------´ │ generator! │ ( _´U_ ) ╰──────────────────────────╯
/A\ /
| ~ |
'..'_
´ |° ´ Y

? What type of application do you want to create? Web Application Basic [without Membership and Authorization]
? Which UI framework would you like to use? Bootstrap (3.3.7)
? What's the name of your ASP.NET application? WebApplicationBasic
create WebApplicationBasic.bowerrc
create WebApplicationBasic\bundleconfig.json
create WebApplicationBasic.gitignore
create WebApplicationBasic\bower.json
create WebApplicationBasic\appsettings.json
create WebApplicationBasic\appsettings.Development.json
create WebApplicationBasic\WebApplicationBasic.csproj
create WebApplicationBasic\Program.cs
create WebApplicationBasic\Properties\launchSettings.json
create WebApplicationBasic\README.md
create WebApplicationBasic\Startup.cs
create WebApplicationBasic\web.config
create WebApplicationBasic\Controllers\HomeController.cs
create WebApplicationBasic\Views_ViewImports.cshtml
create WebApplicationBasic\Views_ViewStart.cshtml
create WebApplicationBasic\Views\Home\About.cshtml
create WebApplicationBasic\Views\Home\Contact.cshtml
create WebApplicationBasic\Views\Home\Index.cshtml
create WebApplicationBasic\Views\Shared_Layout.cshtml
create WebApplicationBasic\Views\Shared\Error.cshtml
create WebApplicationBasic\wwwroot\css\site.css
create WebApplicationBasic\wwwroot\css\site.min.css
create WebApplicationBasic\wwwroot\favicon.ico
create WebApplicationBasic\wwwroot\images\banner1.svg
create WebApplicationBasic\wwwroot\images\banner2.svg
create WebApplicationBasic\wwwroot\images\banner3.svg
create WebApplicationBasic\wwwroot\images\banner4.svg
create WebApplicationBasic\wwwroot\js\site.js
create WebApplicationBasic\wwwroot\js\site.min.js
create WebApplicationBasic\global.json

I'm all done. Running bower install for you to install the required dependencies. If this fails, try running the command yourself.

bower jquery#2.2.4 cached https://github.com/jquery/jquery-dist.git#2.2.4
bower jquery#2.2.4 validate 2.2.4 against https://github.com/jquery/jquery-dist.git#2.2.4
bower jquery-validation#1.15.0 cached https://github.com/jzaefferer/jquery-validation.git#1.15.0
bower jquery-validation#1.15.0 validate 1.15.0 against https://github.com/jzaefferer/jquery-validation.git#1.15.0
bower jquery-validation-unobtrusive#3.2.6 cached https://github.com/aspnet/jquery-validation-unobtrusive.git#3.2
.6
bower jquery-validation-unobtrusive#3.2.6 validate 3.2.6 against https://github.com/aspnet/jquery-validation-unobt
rusive.git#3.2.6
bower bootstrap#3.3.7 cached https://github.com/twbs/bootstrap.git#3.3.7
bower bootstrap#3.3.7 validate 3.3.7 against https://github.com/twbs/bootstrap.git#3.3.7
bower jquery#2.2.4 install jquery#2.2.4
bower jquery-validation-unobtrusive#3.2.6 install jquery-validation-unobtrusive#3.2.6
bower jquery-validation#1.15.0 install jquery-validation#1.15.0
bower bootstrap#3.3.7 install bootstrap#3.3.7

jquery#2.2.4 wwwroot\lib\jquery

jquery-validation-unobtrusive#3.2.6 wwwroot\lib\jquery-validation-unobtrusive
├── jquery#2.2.4
└── jquery-validation#1.15.0

jquery-validation#1.15.0 wwwroot\lib\jquery-validation
└── jquery#2.2.4

bootstrap#3.3.7 wwwroot\lib\bootstrap
└── jquery#2.2.4

Your project is now created, you can use the following commands to get going
cd "WebApplicationBasic"
dotnet restore
dotnet build (optional, build will also happen when it's run)
dotnet run

C:\projects\Reference Applications\asp_net_docker\WebApplicationBasic> ls

Directory: C:\projects\Reference Applications\asp_net_docker\WebApplicationBasic

Mode LastWriteTime Length Name


d----- 3/16/2017 2:23 PM Controllers
d----- 3/16/2017 2:23 PM Properties
d----- 3/16/2017 2:23 PM Views
d----- 3/16/2017 2:23 PM wwwroot
-a---- 3/16/2017 2:23 PM 36 .bowerrc
-a---- 3/16/2017 2:23 PM 4418 .gitignore
-a---- 3/16/2017 2:23 PM 165 appsettings.Development.json
-a---- 3/16/2017 2:23 PM 102 appsettings.json
-a---- 3/16/2017 2:23 PM 219 bower.json
-a---- 3/16/2017 2:23 PM 601 bundleconfig.json
-a---- 3/16/2017 2:23 PM 53 global.json
-a---- 3/16/2017 2:23 PM 555 Program.cs
-a---- 3/16/2017 2:23 PM 2131 README.md
-a---- 3/16/2017 2:23 PM 1967 Startup.cs
-a---- 3/16/2017 2:23 PM 677 web.config
-a---- 3/16/2017 2:23 PM 611 WebApplicationBasic.csproj

C:\projects\Reference Applications\asp_net_docker\WebApplicationBasic> dotnet restore
Restoring packages for C:\projects\Reference Applications\asp_net_docker\WebApplicationBasic\WebApplicationBasic.csproj...
Generating MSBuild file C:\projects\Reference Applications\asp_net_docker\WebApplicationBasic\obj\WebApplicationBasic.csproj.nuget.g.props.
Generating MSBuild file C:\projects\Reference Applications\asp_net_docker\WebApplicationBasic\obj\WebApplicationBasic.csproj.nuget.g.targets.
Writing lock file to disk. Path: C:\projects\Reference Applications\asp_net_docker\WebApplicationBasic\obj\project.assets.json
Restore completed in 1.27 sec for C:\projects\Reference Applications\asp_net_docker\WebApplicationBasic\WebApplicationBasic.csproj.

NuGet Config files used:
C:\Users\me\AppData\Roaming\NuGet\NuGet.Config
C:\Program Files (x86)\NuGet\Config\Microsoft.VisualStudio.Offline.config

Feeds used:
https://api.nuget.org/v3/index.json
C:\Program Files (x86)\Microsoft SDKs\NuGetPackages
C:\projects\Reference Applications\asp_net_docker\WebApplicationBasic> ls

Directory: C:\projects\Reference Applications\asp_net_docker\WebApplicationBasic

Mode LastWriteTime Length Name


d----- 3/16/2017 2:23 PM Controllers
d----- 3/16/2017 2:24 PM obj
d----- 3/16/2017 2:23 PM Properties
d----- 3/16/2017 2:23 PM Views
d----- 3/16/2017 2:23 PM wwwroot
-a---- 3/16/2017 2:23 PM 36 .bowerrc
-a---- 3/16/2017 2:23 PM 4418 .gitignore
-a---- 3/16/2017 2:23 PM 165 appsettings.Development.json
-a---- 3/16/2017 2:23 PM 102 appsettings.json
-a---- 3/16/2017 2:23 PM 219 bower.json
-a---- 3/16/2017 2:23 PM 601 bundleconfig.json
-a---- 3/16/2017 2:23 PM 53 global.json
-a---- 3/16/2017 2:23 PM 555 Program.cs
-a---- 3/16/2017 2:23 PM 2131 README.md
-a---- 3/16/2017 2:23 PM 1967 Startup.cs
-a---- 3/16/2017 2:23 PM 677 web.config
-a---- 3/16/2017 2:23 PM 611 WebApplicationBasic.csproj

C:\projects\Reference Applications\asp_net_docker\WebApplicationBasic> yo docker

 _-----_     ╭──────────────────────────╮
|       |    │   Welcome to the Docker  │
|--(o)--|    │        generator!        │

---------´ │ Let's add Docker │ ( _´U_ ) │ container magic to your │
/A\ /│ app! │
| ~ | ╰──────────────────────────╯
'..'_
´ |° ´ Y

? What language is your project using? .NET Core
? Which version of .NET Core is your project using? rtm
? Does your project use a web server? Yes
? Which port is your app listening to? 5000
? What do you want to name your image? webapplicationbasic
? What do you want to name your service? webapplicationbasic
? What do you want to name your compose project? webapplicationbasic
× Error: Can't read project.json file. Make sure project.json file exists.
at ReadFileContext.callback (C:\ProgramData\nvm\v6.10.0\node_modules\generator-docker\generators\app\dotnetHelper.js:134:16)
at FSReqWrap.readFileAfterOpen [as oncomplete] (fs.js:365:13)
create .vscode\launch.json
create Dockerfile.debug
create Dockerfile
create docker-compose.debug.yml
create docker-compose.yml
create dockerTask.ps1
create dockerTask.sh
create .vscode\tasks.json
Errors occured. Please fix them and re-run the generator.

C:\projects\Reference Applications\asp_net_docker\WebApplicationBasic>

Use a containerized dotnet cli

When I try to run dockerTask.sh, I get a dotnet: command not found exception, and I assumed this boilerplate would allow me to build the app inside a container. In fact, the README says "(...) helps you build and run your project inside of a Docker container". If only one of these steps is ran inside a container, then I think the text is ambiguous.

The main reason I'm containerizing is to be able to use a not-so-well-supported distro such as Arch Linux, where installing the CLI is almost impossible. If it ran inside a container, then I would avoid the need for the CLI at all.

I believe this is possible, and I'm working on it, but does it mean I won't get debugging? Does the debug feature depend on the CLI?

Thanks!

Is linux supported?

I am trying to use generator in linux environment, but it fails F5 with an error - Could not find the preLaunchTask 'composeForDebug'.
In tasks.json I see it defined but only for windows and osx. Is there any steps I need to do to run it on linux? (Ubuntu)

How volumes are mounted?

I checked Dockerfile.debug and DockerTask.ps1 and can't find how volumes are mounted

I also can't find much information about Microsoft.Dnx.Watcher

Thanks,

Wrong docker run path generated for node on windows

Problem is wrong generated path for volume flag in docker run command.
Issue in windows 7 within cmd.

This is generated command in dockerTask.cmd:
docker run -di -p %publicPort%:%containerPort% -v /C:/Users\Lajt\Code\playground\testdoc:/src %imageName%
error after run command:
invalid value "/C:/Users\\Lajt\\Code\\playground\\testdoc:/src" for flag -v: bad mode specified: /src See 'docker run --help'.

Solution:
generated command should looks like:
docker run -di -p %publicPort%:%containerPort% -v /c/Users/Lajt/Code/playground/testdoc:/src %imageName%

Where does the dll come from for C# projects?

Hello,

I used the C# project https://github.com/SteveLasker/DotNetCoreMultiService.API
I was able to run "dotnet run" directly from my machine and got the service running.
I removed the existing docker files and then used "yo docker" to generate them.
The main problem I'm facing is that the entrypoint is: ENTRYPOINT dotnet MultiService.API.dll
However it seems I can't get MultiService.API.dll to show up in the project even after I run "dotnet run".

Thank you in advance!

--Gordon

Yo Docker -> .Net Core Error: Can't read project.json file. Make sure it exists.

Hello all, love the generator and thanks for the hard work. I get the error above on multiple computers but node.js works fine so I'm thinking it's a small bug with all of the new updated stuff coming out.

But when I yo docker and select .Net Core to then go through the process... I get the error in the title. When I look at the path provided I do find the project.json file and I do find the dotnetHelper.js file so the files do exist. Am I missing something as a somewhat newbie?

Thanks again for any advice.

Start container not in background when not a server

Shouldn't the option -d be optional? Or rather only if it is a webserver? Maybe an additional check on initialization which asks if the container is a simple console application?
Currenlty if one is working on a console application, he/she will simply not see any output from it.

I'm referring to:

and

enable --no-cache for build command

There is no way to pass the --no-cache flag for building the image in the event your local cache is bad or you want to force a complete rebuild of the image.

./dockerTask.sh build --no-cache

Switch default docker host to Docker For Windows/Mac

Prior to DockerCon, D4W, D4M were private betas which meant our tools needed a default host that developers could get directly.
Now that D4W, D4M is now a public beta, we should switch to using them as the default, with a doc explaining how to use docker-machine for other hosts like virtualbox.

How to start with newest source?

I tried the docker debug experience with .net core 1.1 on vscode on mac and after i updated the script everything works so far. But I cannot get the newest source to run. So whenever I hit F5 the old code is ran, even if I made changes. What do I miss or is it a bug in the script?

Error installing clrdbg using the generated DockerFile.debug

Based off this guide
https://docs.microsoft.com/en-us/dotnet/articles/core/docker/building-net-docker-images

I'm running vs code and starting a debug session but the deployment of clrdbg fails. The same occurs when I run ./dockerTask -Build in PowerShell

Below is the output

Using arguments
Version : 'VS2015U2'
Location : ''
SkipDownloads : 'false'
LaunchClrDbgAfter : 'false'
RemoveExistingOnUpgrade : 'false'
Info: Using clrdbg version '15.0.26022.0'
Info: Previous installation at not found
Error: Install location is not set
Service 'api' failed to build: The command '/bin/sh -c curl -SL https://raw.githubusercontent.com/Microsoft/MIEngine/getclrdbg-release/scripts/GetClrDbg.sh --output GetClrDbg.sh && chmod 700 GetClrDbg.sh && ./GetClrDbg.sh $CLRDBG_VERSION && rm GetClrDbg.sh' returned a non-zero code: 1****

Add ASPNETCORE_URLS to the dockerfile and Docker.compose.*.yml files

Dotnet RTM will look for this environment variable by default. However, without this being set, an ASP.NET Web App will not listen to traffic within a container as Kestrel needs to be informed to listen beyond localhost.
Work is to add this environment variable, with a pre-defined value of port 80 in the dockerfile, with an EXPOSE of port 80 by default, and compose that also sets it demonstrating how to change the port if needed

VSCode Debug Error After Upgrading to RTM (Unknown option 'client-ui'.)

OS: OSX El Capitan 10.11.5
Docker: Docker for mac 1.12.0-rc2-beta17
IDE: VSCode 1.2.1
C# Omnisharp Extention 1.2.1
Dotnet --version output: 1.0.0-preview2-003121
[email protected]
[email protected]

Steps to reproduce:

  1. yo aspnet
  2. choose Web API Application
  3. Name application dockertest
  4. cd dockertest
  5. rm Dockerfile
  6. yo docker
? What language is your project using? .NET Core
? Which version of .NET Core is your project using? rtm
? Which port is your app listening to? 5000
? What do you want to name your image? dockertest
? What do you want to name your service? dockertest
? What do you want to name your compose project? dockertest
   create .dockerignore
   create .vscode/launch.json
   create Dockerfile.debug
   create Dockerfile
   create docker-compose.debug.yml
   create docker-compose.yml
   create dockerTask.ps1
   create dockerTask.sh
   create .vscode/tasks.json
We noticed your project.json file didn't use portable .pdb files. We've fixed that for you.
Your project is now ready to run in a Docker container!
Run dockerTask.sh to build a Docker image and run your app in a container.

  1. Open project in vs code
  2. Go to debug tab
  3. Run debugger

Expected outcome: App begins debugging.

Actual outcome: VS Code shows the followoing Error:

Unable to start debugging. Unexpected CLRDBG output from command "-gdb-set client-ui "VSCode"". Unknown option 'client-ui'.

Debug .NET Core with docker containers

[Copied from https://github.com/dotnet/dotnet-docker/issues/185]

What is the proper way to install the debugger on a dotnet image and get it debugging from VSCode?

Currently there are multiple (messy) ways to work with old project.json and containers like for example, that bunch of scripts generated by yo docker.

Is there any guidance on how to create a debug container for .net apps?

Thank you
@galvesribeiro

Bug - When using a - with Yo Docker as part of the project/composed app, Build/Debugging doesn't work

I made quite a few tests and conclude saying that When using a "-" with Yo Docker as part of the project/composed app, Build/Debugging doesn't work.

THIS DOESN’T WORK:
$imageName="cesardl/netcorewebapimicroservice25"
$projectName="docker-composed-app"  BUG
$serviceName="netcorewebapimicroservice25"

THIS WORKS:
$imageName="cesardl/netcore-webapi-microservice2"
$projectName="dockercomposedapp"
$serviceName="netcore-webapi-microservice2"

I think that the issue/bug with “-” happens only for the projectName (which is the ComposedAppName)

Thanks,
Cesar.

Sample error:
Starting: "C:\windows\System32\WindowsPowerShell\v1.0\powershell.exe" .\dockerTask.ps1 -StartDebugging
Running on http://docker:5000
StartDebugging : Could not find a container named docker-composed-app_netcorewebapimicroservice25_1
At C:\Dev\BugCaseComposedApp\netcorewebapimicroservice25\dockerTask.ps1:156 char:5

  • StartDebugging
    
  • ~~~~~~~~~~~~~~
    
    • CategoryInfo : NotSpecified: (:) [Write-Error], WriteErrorException
    • FullyQualifiedErrorId : Microsoft.PowerShell.Commands.WriteErrorException,StartDebugging
      EOF
      "C:\windows\System32\WindowsPowerShell\v1.0\powershell.exe" exited with code 0 (0x0).

Async Debugging Variable Scope

My Web API project is using async methods, and when I use this generator to run the app in the docker container with remote debugging not all variables are in scope in the locals window. The code runs fine if i just continue the execution, but I can't inspect variable values. When I debug the project without the docker container(just locally on my dev machine) all variables show in the locals window.

Screenshot while debugging through docker:
screen shot 2016-11-04 at 1 13 07 pm

Screenshot of same code debugging locally:
screen shot 2016-11-04 at 1 22 05 pm

Notice that organization is shown in the locals screen when debugging locally, but not remotely. Also, look at the debug output where i typed in the variable name "organization" and i get the value for the object when debugging local, but not remote. The call stack is different as well.

The app returns the organization in both instances, but just can't inspect while debugging in docker.

Any help is appreciated.
Thanks!

Support for Visual Studio 2015?

Was happy to find this project as I'd like a cross-platform friendly option here for debugging and running my app in a Docker container through VS Code as some of our developers use Macs and VS Code and others use Visual Studio and Windows.

It would be nice if this also had support for Visual Studio as well or overlapped with the Visual Studio Toolbox project so that I could as easily launch this from Visual Studio. Currently it seems like their solution there has diverged a bit from yours with some things working better in this solution and some things working better in their solution.

Any plans to get the PowerShell and approach aligned between the two? Any current stumbling blocks preventing us from doing so, etc?

Allow generator-docker to be called with options, and prevent prompt

To improve composability, add options to the generator code.

  1. use the options as default properties
  2. do not prompt for parameters when an option is already defined

i.e:

constructor: function () {
  yeoman.Base.apply(this, arguments);

  this.option('boilerplate', {
      type: Boolean,
      required: false,
      desc: 'Include Boilerplate'
  });
},

initializing: function () {
  this.props = {
      boilerplate: Boolean(this.options.boilerplate)
  };
},

prompting: function () {
  var prompts = [{
      type: 'confirm',
      name: 'boilerplate',
      message: 'Include Boilerplate',
      default: true,,
      when: this.options.boilerplate === undefined
    }];

  return this.prompt(prompts)
      .then(function (props) {
        this.props = extend(this.props, props);
      }.bind(this));
}

Use docker-compose build

With docker-compose v2, we can now specify the image name as well as the build context/dockerfile.
Rather than build and tag the image as pre-steps, we could use docker-compose.debug.yml to specify the image tag and dockerfile location. We can then use docker-compose build as a single entrypoint in our dockerTask.sh script

Don't stop on the first line of my server code in Node.js when debugging

yo docker scaffolds out a dockerfile that uses dockerfile.debug with the following entry point

ENTRYPOINT ["/bin/bash", "-c", "if [ -z \"$REMOTE_DEBUGGING\" ]; then nodemon -L --debug; else nodemon -L --debug-brk; fi"]

However, when the developer starts debugging, we stop on the first line of their server.js code
By adding "stopOnEntry": false to launch.json, the debugger will no longer stop on the first line, but hit the breakpoint.

Dotnet-maintain the container running, unless it needs to be rebuilt

with node, we have a two step process. start the container, then make changes/debug.
With .NET Core, we have a cleaner, one step process, however we rebuild the container and compose up each time

This is to be smarter about what we rebuild. Upon starting a debug session:

  • If the container is running, use it
  • If the container isn't running, build and compose it
  • If the developer changes the dockerfile or compose file, prompt the developer that making changes will require a restart of the debugger, and rebuild of the image

Operation not permitted when running bash script from task

From @egamma on January 31, 2017 10:1

From @spboyer on January 30, 2017 16:49

VSCode Version: Version 1.8.1
OS Version: macOS Sierra 10.12.2 (16C67)

Steps to Reproduce:

  1. clone repo https://github.com/spboyer/dockerdebugapp
  2. open debug pane and run
  3. Console outputs: "/bin/bash: ./dockerTask.sh: Operation not permitted"

Can run bash script from terminal with no problems without sudo.

Copied from original issue: microsoft/vscode#19586

Copied from original issue: dotnet/vscode-csharp#1162

Add Go remote debugging support

I think it would be nice to enable go remote debugging as in the dotnet version of this generator.

Some documentation about the golang docker generator would be great, too.

Unit testing

How should I configure my (dotnet) project created by yo docker for unit testing?
Obviously I need a separate test project, but how can I reference my actual project so that the unit tests also run in the container and not locally?
Thanks!

DotNet dockerfile.debug should use restore, while release should use publish

Our inner loop development story focuses on the .net restore capabilities as thats how the standard IIS Express functionality works. The dockerfile.debug should mount the source and use dotnet watch for monitoring changes, allowing the developer to achieve edit & refresh during development, including debugging, while release should mimic the production deployment using the optimized base image and published output.

Cannot run DotNet Core in Docker Container

Following this tutorial, I am able to run a new DotNet Core Web application locally just fine (via Command Line).

However, as soon as I try to run it in a container (via VS Code Debugger), I receive the following exception:
Unhandled Exception: System.IO.DirectoryNotFoundException: Could not find a part of the path '/root/.nuget/packages/.tools/BundlerMinifier.Core'.

I have not made any changes to any files at this point.

Environment: Windows 10 x64 with Docker for Windows.

Suport // in settings.json

VSCode is able to parse .vscode/settings.json that contain // comments despite that this is a not valid JSON. However, the generator uses a standard JSON.parse() to get the contents of this file if it already exists. Here's the result:

? What do you want to name your compose project? xyz
undefined:1
// Place your settings in this file to overwrite default and user settings.
^

SyntaxError: Unexpected token / in JSON at position 0
    at Object.parse (native)
    at /usr/local/lib/node_modules/generator-docker/generators/app/baseHelper.js:126:25
    at tryToString (fs.js:449:3)
    at FSReqWrap.readFileAfterClose [as oncomplete] (fs.js:436:12)
lhrazk@lhrazk-VirtualBox:~/-/x/y/z$ yo docker

Would be good if the parser was a bit smarter, I'm sure there is one being used in vscode.

Add steps to use Node.js and DotNet Debugging

Node debugging requires a two step process. Command Pallet: task composeForDebug, then start debugging.
Dotnet is a simple start debugging

These steps should be documented on the readme.md page,

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.