Skip to content

Commit ec28a35

Browse files
authored
Add .devcontainer details (#1)
1 parent 1987581 commit ec28a35

File tree

8 files changed

+752
-3
lines changed

8 files changed

+752
-3
lines changed

.devcontainer/Dockerfile

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# Ubuntu 18.04 LTS
2+
FROM mcr.microsoft.com/dotnet/core/sdk:3.1-bionic
3+
4+
WORKDIR /home/
5+
6+
COPY . .
7+
8+
RUN bash ./setup.sh

.devcontainer/devcontainer.json

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
{
2+
"name": "Codespaces .NET Core Starter",
3+
"extensions": [
4+
// "coenraads.bracket-pair-colorizer-2",
5+
"donjayamanne.githistory",
6+
"eamodio.gitlens",
7+
"editorconfig.editorconfig",
8+
"github.vscode-pull-request-github",
9+
"jongrant.csharpsortusings",
10+
"k--kato.docomment",
11+
"kreativ-software.csharpextensions",
12+
"mhutchie.git-graph",
13+
"ms-azuretools.vscode-azurefunctions",
14+
"ms-azuretools.vscode-docker",
15+
"ms-dotnettools.csharp",
16+
"ms-vscode.powershell",
17+
"ms-vsliveshare.vsliveshare",
18+
// "vscode-icons-team.vscode-icons",
19+
"visualstudioexptteam.vscodeintellicode",
20+
"yzhang.markdown-all-in-one"
21+
],
22+
"dockerFile": "Dockerfile",
23+
"forwardPorts": [5000, 5001, 7071],
24+
"settings": {
25+
"terminal.integrated.shell.linux": "/usr/bin/zsh",
26+
"files.exclude": {
27+
"**/CODE_OF_CONDUCT.md": true,
28+
"**/LICENSE": true
29+
}
30+
}
31+
}

.devcontainer/setup.sh

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
## Update and install some things we should probably have
2+
apt-get update
3+
apt-get install -y \
4+
curl \
5+
git \
6+
gnupg2 \
7+
jq \
8+
sudo \
9+
zsh
10+
11+
## Instsall nvm
12+
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.35.3/install.sh | bash
13+
14+
## Install Docker CE
15+
curl -fsSL https://get.docker.com | bash
16+
17+
## Update to the latest PowerShell
18+
curl -sSL https://raw.githubusercontent.com/PowerShell/PowerShell/master/tools/install-powershell.sh | bash
19+
20+
## Install Azure Functions Core Tools v3
21+
wget -q https://packages.microsoft.com/config/ubuntu/18.04/packages-microsoft-prod.deb
22+
dpkg -i packages-microsoft-prod.deb
23+
apt-get update
24+
apt-get install azure-functions-core-tools-3
25+
26+
## Enable local HTTPS for .NET Core
27+
dotnet dev-certs https --trust
28+
29+
## Setup and install oh-my-zsh
30+
sh -c "$(curl -fsSL https://raw.githubusercontent.com/robbyrussell/oh-my-zsh/master/tools/install.sh)"
31+
cp -R /root/.oh-my-zsh /home/$USERNAME
32+
cp /root/.zshrc /home/$USERNAME
33+
sed -i -e "s/\/root\/.oh-my-zsh/\/home\/$USERNAME\/.oh-my-zsh/g" /home/$USERNAME/.zshrc
34+
chown -R $USER_UID:$USER_GID /home/$USERNAME/.oh-my-zsh /home/$USERNAME/.zshrc

.editorconfig

Lines changed: 435 additions & 0 deletions
Large diffs are not rendered by default.

.gitignore

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -348,3 +348,10 @@ MigrationBackup/
348348

349349
# Ionide (cross platform F# VS Code tools) working folder
350350
.ionide/
351+
352+
# For MacOS
353+
.DS_Store
354+
355+
# Azure Functions
356+
# Comment if it needs to be included
357+
local.settings.json

CODE_OF_CONDUCT.md

Lines changed: 128 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,128 @@
1+
# Contributor Covenant Code of Conduct
2+
3+
## Our Pledge
4+
5+
We as members, contributors, and leaders pledge to make participation in our
6+
community a harassment-free experience for everyone, regardless of age, body
7+
size, visible or invisible disability, ethnicity, sex characteristics, gender
8+
identity and expression, level of experience, education, socio-economic status,
9+
nationality, personal appearance, race, religion, or sexual identity
10+
and orientation.
11+
12+
We pledge to act and interact in ways that contribute to an open, welcoming,
13+
diverse, inclusive, and healthy community.
14+
15+
## Our Standards
16+
17+
Examples of behavior that contributes to a positive environment for our
18+
community include:
19+
20+
* Demonstrating empathy and kindness toward other people
21+
* Being respectful of differing opinions, viewpoints, and experiences
22+
* Giving and gracefully accepting constructive feedback
23+
* Accepting responsibility and apologizing to those affected by our mistakes,
24+
and learning from the experience
25+
* Focusing on what is best not just for us as individuals, but for the
26+
overall community
27+
28+
Examples of unacceptable behavior include:
29+
30+
* The use of sexualized language or imagery, and sexual attention or
31+
advances of any kind
32+
* Trolling, insulting or derogatory comments, and personal or political attacks
33+
* Public or private harassment
34+
* Publishing others' private information, such as a physical or email
35+
address, without their explicit permission
36+
* Other conduct which could reasonably be considered inappropriate in a
37+
professional setting
38+
39+
## Enforcement Responsibilities
40+
41+
Community leaders are responsible for clarifying and enforcing our standards of
42+
acceptable behavior and will take appropriate and fair corrective action in
43+
response to any behavior that they deem inappropriate, threatening, offensive,
44+
or harmful.
45+
46+
Community leaders have the right and responsibility to remove, edit, or reject
47+
comments, commits, code, wiki edits, issues, and other contributions that are
48+
not aligned to this Code of Conduct, and will communicate reasons for moderation
49+
decisions when appropriate.
50+
51+
## Scope
52+
53+
This Code of Conduct applies within all community spaces, and also applies when
54+
an individual is officially representing the community in public spaces.
55+
Examples of representing our community include using an official e-mail address,
56+
posting via an official social media account, or acting as an appointed
57+
representative at an online or offline event.
58+
59+
## Enforcement
60+
61+
Instances of abusive, harassing, or otherwise unacceptable behavior may be
62+
reported to the community leaders responsible for enforcement at
63+
64+
All complaints will be reviewed and investigated promptly and fairly.
65+
66+
All community leaders are obligated to respect the privacy and security of the
67+
reporter of any incident.
68+
69+
## Enforcement Guidelines
70+
71+
Community leaders will follow these Community Impact Guidelines in determining
72+
the consequences for any action they deem in violation of this Code of Conduct:
73+
74+
### 1. Correction
75+
76+
**Community Impact**: Use of inappropriate language or other behavior deemed
77+
unprofessional or unwelcome in the community.
78+
79+
**Consequence**: A private, written warning from community leaders, providing
80+
clarity around the nature of the violation and an explanation of why the
81+
behavior was inappropriate. A public apology may be requested.
82+
83+
### 2. Warning
84+
85+
**Community Impact**: A violation through a single incident or series
86+
of actions.
87+
88+
**Consequence**: A warning with consequences for continued behavior. No
89+
interaction with the people involved, including unsolicited interaction with
90+
those enforcing the Code of Conduct, for a specified period of time. This
91+
includes avoiding interactions in community spaces as well as external channels
92+
like social media. Violating these terms may lead to a temporary or
93+
permanent ban.
94+
95+
### 3. Temporary Ban
96+
97+
**Community Impact**: A serious violation of community standards, including
98+
sustained inappropriate behavior.
99+
100+
**Consequence**: A temporary ban from any sort of interaction or public
101+
communication with the community for a specified period of time. No public or
102+
private interaction with the people involved, including unsolicited interaction
103+
with those enforcing the Code of Conduct, is allowed during this period.
104+
Violating these terms may lead to a permanent ban.
105+
106+
### 4. Permanent Ban
107+
108+
**Community Impact**: Demonstrating a pattern of violation of community
109+
standards, including sustained inappropriate behavior, harassment of an
110+
individual, or aggression toward or disparagement of classes of individuals.
111+
112+
**Consequence**: A permanent ban from any sort of public interaction within
113+
the community.
114+
115+
## Attribution
116+
117+
This Code of Conduct is adapted from the [Contributor Covenant][homepage],
118+
version 2.0, available at
119+
https://www.contributor-covenant.org/version/2/0/code_of_conduct.html.
120+
121+
Community Impact Guidelines were inspired by [Mozilla's code of conduct
122+
enforcement ladder](https://github.com/mozilla/diversity).
123+
124+
[homepage]: https://www.contributor-covenant.org
125+
126+
For answers to common questions about this code of conduct, see the FAQ at
127+
https://www.contributor-covenant.org/faq. Translations are available at
128+
https://www.contributor-covenant.org/translations.

LICENSE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
MIT License
22

3-
Copyright (c) 2020 codespaces-examples
3+
Copyright (c) 2020 CODESPACES EXAMPLES (https://github.com/codespaces-examples)
44

55
Permission is hereby granted, free of charge, to any person obtaining a copy
66
of this software and associated documentation files (the "Software"), to deal

README.md

Lines changed: 108 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,108 @@
1-
# dotnetcore
2-
A starter .NET Core development environment for Codespaces
1+
# Codespaces .NET Core Starter #
2+
3+
This project is a .NET Core starter for developers to use in Codespaces that includes basic system tools and extensions for .NET Core app development.
4+
5+
6+
## What's Included ##
7+
8+
This is an unopinionated, basic environment that should be ready to expand upon to build a day-to-day development envrionment. It comes with the following software choices:
9+
10+
11+
### System Tools ###
12+
13+
* [curl/curl](https://github.com/curl/curl): the command line tool for transferring data over a metric boatload of protocols.
14+
* git: the Git SCM tool.
15+
* [gnupg2](https://gnupg.org/): a complete and free implementatiuon of the OpenPGP standard.
16+
* [stedolan/jq](https://github.com/stedolan/jq): a command line JSON parser.
17+
* [sudo](https://www.sudo.ws/): the superuser authority delegation tool.
18+
* [zsh](https://www.zsh.org/): interactive terminal (alternative to `bash`).
19+
* [ohmyzsh/ohmyzsh](https://github.com/ohmyzsh/ohmyzsh): a delightful community driven framework for managing zsh config.
20+
* [.NET Core SDK 3.1 LTS](https://dotnet.microsoft.com/download/dotnet-core/3.1?WT.mc_id=codespacesexamples-github-juyoo): a free, cross-platform and open source developer platform for building all types of apps.
21+
* [Azure Functions Core Tools v3](https://docs.microsoft.com/azure/azure-functions/functions-run-local?tabs=linux%2Ccsharp%2Cbash&WT.mc_id=codespacesexamples-github-juyoo): lets you develop and test your functions on your local computer from the command prompt or terminal.
22+
* [Docker CE](https://docs.docker.com/engine/install/ubuntu/): runs Docker CLI inside Codespaces.
23+
* [PowerShell 7](https://docs.microsoft.com/powershell/scripting/how-to-use-docs?view=powershell-7&WT.mc_id=codespacesexamples-github-juyoo): a cross-platform task automation and configuration management framework, consisting of a command-line shell and scripting language.
24+
25+
> **NOTE**: Docker daemon can't be running inside Codespaces. Instead, set `DOCKER_HOST` to access to a remote docker daemon.
26+
27+
28+
### VS Code Extensions ###
29+
30+
The following extensions are installed for .NET Core development.
31+
32+
* [Azure Functions](https://marketplace.visualstudio.com/items?itemName=ms-azuretools.vscode-azurefunctions): quickly create, debug, manage, and deploy serverless apps directly from VS Code.
33+
* [C#](https://marketplace.visualstudio.com/items?itemName=ms-dotnettools.csharp): Included for C# development.
34+
* [C# Extensions](https://marketplace.visualstudio.com/items?itemName=kreativ-software.csharpextensions): Included to speed up development workflows.
35+
* [C# Sort Usings](https://marketplace.visualstudio.com/items?itemName=jongrant.csharpsortusings): Included for document formatting.
36+
* [C# XML Documentation Comments](https://marketplace.visualstudio.com/items?itemName=k--kato.docomment): Included for XML style C# code documentation.
37+
* [Docker](https://marketplace.visualstudio.com/items?itemName=ms-azuretools.vscode-docker): Included for .NET Core developers who work with Docker, but also to enable users to edit `.devcontainer/Dockerfile` with proper editing.
38+
* [EditorConfig](https://marketplace.visualstudio.com/items?itemName=EditorConfig.EditorConfig): Included for .NET Core code formatting found in `.editorconfig`.
39+
* [Git Graph](https://marketplace.visualstudio.com/items?itemName=mhutchie.git-graph): View a Git Graph of your repository, and perform Git actions from the graph.
40+
* [Git History](https://marketplace.visualstudio.com/items?itemName=donjayamanne.githistory): View git log, file history, compare branches or commits
41+
* [GitHub Pull Requests and Issues](https://marketplace.visualstudio.com/items?itemName=github.vscode-pull-request-github): Integration with GitHub's Pull Requests and Issues features that significantly enhance the experience of working in a repo hosted on GitHub.
42+
* [GitLens](https://marketplace.visualstudio.com/items?itemName=eamodio.gitlens): An extension that significantly enhances the experience using Git in a development environment.
43+
* [IntelliCode](https://marketplace.visualstudio.com/items?itemName=visualstudioexptteam.vscodeintellicode): AI-assisted development for multiple languages including JavaScript and TypeScript.
44+
* [Live Share](https://marketplace.visualstudio.com/items?itemName=ms-vsliveshare.vsliveshare): collaborative, multi-user remote editing from directly within the editor.
45+
* [Markdown All in One](https://marketplace.visualstudio.com/items?itemName=yzhang.markdown-all-in-one): All you need to write README.md in Markdown.
46+
* [PowerShell](https://marketplace.visualstudio.com/items?itemName=ms-vscode.PowerShell): This extension provides rich PowerShell language support.
47+
48+
The following extensions are intentionally disabled until they support remote server.
49+
50+
* ~~[Bracket Pair Colorizer 2](https://marketplace.visualstudio.com/items?itemName=CoenraadS.bracket-pair-colorizer-2): An extension colors matching brackets appropriately to enhance code readability.~~
51+
* ~~[vscode-icons](https://marketplace.visualstudio.com/items?itemName=vscode-icons-team.vscode-icons): An enhancement to the editor UI that gives more visual indicators in the explorer.~~
52+
53+
54+
### Dotfiles ###
55+
56+
Dotfiles are meant to be personalised configuration. But the following dotfiles are largely common for .NET Core application development.
57+
58+
* [.gitignore](https://gitignore.io): Sourced from [gitignore.io](https://gitignore.io) configured for `VisualStudio`.
59+
* [.editorconfig](https://editorconfig.org/): Sourced from [@RehanSaeedUK](https://twitter.com/RehanSaeedUK)'s [.editorconfig](https://github.com/RehanSaeed/EditorConfig/blob/master/.editorconfig)
60+
61+
62+
### Operating System ###
63+
64+
* [Ubuntu 18.04](https://releases.ubuntu.com/18.04.4/): The 18.04 LTS version of Ubuntu.
65+
66+
67+
## Usage ##
68+
69+
### In VS Codespaces ###
70+
71+
#### Initial Creation ####
72+
73+
For usage in VS Codespaces, you're going to want to head over to [online.visualstudio.com](https://online.visualstudio.com) and sign up for VS Codespaces (that process is outside the scope of these instructions). Once you've got an account and are signed in to [online.visualstudio.com](https://online.visualstudio.com), you're going to take the following steps:
74+
75+
* Ensure you're on the `/environments` page at [online.visualstudio.com/environments](https://online.visualstudio.com/environments)
76+
* In the top right corner, there'll be a "Create environment" button. Click this button, which will open up a panel from the right side of the screen. Fill in the details of this panel:
77+
* **Environment Name:** This will be the visible name of your environment within Codespaces. The value here doesn't particularly matter * I'm going to use `tinycloud`.
78+
* **Git Repository:** This is going to be either the URL you'd `git clone` the repo from or the GitHub `<org OR user>/<repo>` shorthand. For this repo, the easier value would be `codespaces-examples/base`.
79+
* **Instance Type:** For this, you're going to choose your plan * in my case, I'm just going to go with the `Standard (Linux)` plan. For most use cases of this starter, `Basic (Linux)` should suffice. You can also change your plan at any time, as your workload demands.
80+
* **Suspend idle environment after:** This is the period of time you want your environment to automatically suspend after you've stopped actively using it. I generally chose 5 minutes and have not had any problems to date.
81+
* **Dotfiles (optional):** These are entirely optional, and are available for advanced users.
82+
* **Dotfiles Repository:** Using the `git clone` URL or the GitHub `<org OR user>/<repo>` syntax, you can define the repo to pull your dotfiles from. For examples, see [jessfraz/dotfiles](https://github.com/jessfraz/dotfiles) or [fnichol/dotfiles](https://github.com/fnichol/dotfiles).
83+
* **Dotfiles Install Command:** The name of the file or the command to run to install your dotfiles.
84+
* **Dotfiles Target Path:** The path where your dotfiles should be installed.
85+
* Once you've filled out all of those (and resolved any errors in the form validation, if any occurred), you'll be able to click "Create" at the bottom of the panel and your environment will start creating.
86+
87+
88+
#### Connecting to your Environment ####
89+
90+
Once you've completed the Creation steps, your environment will be usable from Codespaces until you delete it. You can access it by going to [online.visualstudio.com](https://online.visualstudio.com) and selecting the vertical ellipsis menu to connect to it from the browser or launch it in VS Code / VS Code Insiders.
91+
92+
When inside of the environment you can change envrionments themselves from the command pallete with the `Codespaces: Connect`.
93+
94+
> **Note:** See the [VS Online in the Browser](https://docs.microsoft.com/visualstudio/online/quickstarts/browser?WT.mc_id=codespacesexamples-github-juyoo) quickstart for more information.
95+
96+
Additionally, if you've installed the [Visual Studio Codespaces](https://marketplace.visualstudio.com/items?itemName=ms-vsonline.vsonline) extension in VS Code locally, you'll be able to directly connect from VS Code itself.
97+
98+
> **Note:** See the [VS Online in VS Code](https://docs.microsoft.com/visualstudio/online/quickstarts/vscode?WT.mc_id=codespacesexamples-github-juyoo) quickstart for more information.
99+
100+
101+
#### Working ####
102+
103+
Now that you're set up and connected, you should be able to work within your Codespaces environment.
104+
105+
106+
## Contributing ##
107+
108+
Contributions are welcome. Please refrain from opinionated additions like linters. However, adding package managers and other DX improvements that are additive like `yarn` or `EditorConfig` are welcome. Contributors must follow the [Code of Conduct](./CODE_OF_CONDUCT.md).

0 commit comments

Comments
 (0)