Skip to content

Add devcontainer support for building in container #993

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 6 commits into from
Nov 20, 2019

Conversation

bergmeister
Copy link
Contributor

See below link for instructions but basically one just needs to have Docker running in Linux mode with file sharing enabled, install the ms-vscode-remote.remote-containers and then just open VS-Code in that folder and use the command to re-open the folder in a container. Because it is early days, one cannot set the default shell to PowerShell yet, but one can define the following user setting to have the shell that is attached to the container starting with PowerShell instead of bash.
"terminal.integrated.shell.linux": "/usr/bin/pwsh",
https://code.visualstudio.com/docs/remote/containers

@bergmeister bergmeister requested a review from rjmholt as a code owner July 18, 2019 08:11
@TylerLeonhardt
Copy link
Member

This is neat! So I see this primarily being useful for running tests, right?

@bergmeister
Copy link
Contributor Author

bergmeister commented Jul 26, 2019

You can run tests as well, my personal experience though is that for longer test suites that take several minutes like PSSA is that Invoke-Pester can make the remote connection to the container hang.
For me the primary benefit is to have a dev environment that works out of the boxcontainer, is clean (remember the times when PSES wrote into AppData) and does not touch/mess with my global system. For other, new people coming to the project and just wanting to tweak a small portion of C# code, it will be a blessing as well. I haven't looked at whether all the other commands or F5 work, I just attach a shell and run Invoke-Build for the moment. I plan to write a blog post (probably have time for that only in 1.5 weeks though) on the feature generally as I got .devcontainer support already into the main PowerShell repo. We had to disable the red-herring codacy flag though (because the no-install-recommends option is actually used on apt-get install but is not available on apt-get update)

@PowerShell PowerShell deleted a comment Jul 26, 2019
@PowerShell PowerShell deleted a comment Jul 26, 2019
@PowerShell PowerShell deleted a comment Jul 26, 2019
@PowerShell PowerShell deleted a comment Jul 26, 2019
@PowerShell PowerShell deleted a comment Jul 26, 2019
@PowerShell PowerShell deleted a comment Jul 26, 2019
@PowerShell PowerShell deleted a comment Jul 26, 2019
@PowerShell PowerShell deleted a comment Jul 26, 2019
@PowerShell PowerShell deleted a comment Jul 26, 2019
@PowerShell PowerShell deleted a comment Jul 26, 2019
@PowerShell PowerShell deleted a comment Jul 26, 2019
@PowerShell PowerShell deleted a comment Jul 26, 2019
@PowerShell PowerShell deleted a comment Jul 26, 2019
@PowerShell PowerShell deleted a comment Jul 26, 2019
@PowerShell PowerShell deleted a comment Jul 26, 2019
@PowerShell PowerShell deleted a comment Jul 26, 2019
@PowerShell PowerShell deleted a comment Jul 26, 2019
@PowerShell PowerShell deleted a comment Jul 26, 2019
@bergmeister
Copy link
Contributor Author

Sorry, for the many, intermittent pushes, I am done now and fully rebuilt the container just to double check it is still working. Not sure about the current build failures though

Copy link
Member

@TylerLeonhardt TylerLeonhardt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry this took so long... I think we should use the new SDK image that has PowerShell installed and also use the Preview extension instead.

# Licensed under the MIT License. See https://go.microsoft.com/fwlink/?linkid=2090316 for license information.
#-------------------------------------------------------------------------------------------------------------

FROM mcr.microsoft.com/dotnet/core/sdk:2.1.602
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you target the new .NET Core 3.0+ SDK container it contains PowerShell and you won't need to install it.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree but before that the main build needs to move .net core 3 (I vaguely remember the build to not work with it, but maybe that was an issue with one of the previews)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Gooood point. Looks like that is the case: #1095

Maybe we can try to get that figured out first before this goes in? My team put in work to get PowerShell inside the SDK container - I'd love to leverage that if possible as a form of dogfooding it.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@rjmholt abandoned that PR so I'm ok with this going in as is. When we move to .NET SDK 3.0, we can revisit changing the container.

Co-Authored-By: Tyler James Leonhardt <[email protected]>
@PowerShell PowerShell deleted a comment Nov 20, 2019
@TylerLeonhardt
Copy link
Member

Next do vscode-powershell!

@TylerLeonhardt TylerLeonhardt merged commit 085548f into PowerShell:master Nov 20, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants