Skip to content
This repository has been archived by the owner on Nov 30, 2023. It is now read-only.

Commit

Permalink
Another restructure rev
Browse files Browse the repository at this point in the history
  • Loading branch information
Chuxel committed Mar 27, 2019
1 parent 101da4c commit 3607475
Show file tree
Hide file tree
Showing 143 changed files with 1,180 additions and 282 deletions.
72 changes: 72 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
# Contributing

Have a container set up you're proud of and would like to share? Want to see some changes made to an existing definition? We love contributions and suggestions! Most contributions require you to agree to a
Contributor License Agreement (CLA) declaring that you have the right to, and actually do, grant us
the rights to use your contribution. For details, visit https://cla.microsoft.com.

When you submit a pull request, a CLA-bot will automatically determine whether you need to provide
a CLA and decorate the PR appropriately (e.g., label, comment). Simply follow the instructions
provided by the bot. You will only need to do this once across all repos using our CLA.

This project has adopted the [Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/).
For more information see the [Code of Conduct FAQ](https://opensource.microsoft.com/codeofconduct/faq/) or
contact [opencode@microsoft.com](mailto:opencode@microsoft.com) with any additional questions or comments.

## Contributing a definition

If you want to create a new definition:

1. Fork and clone this repository

2. Create a new folder in the `containers` directory. The name of the folder is effectively the **definition ID** and should follow the following format:

````
<language>-<optional: version>-<descriptor>
````

You'll find many examples in the current `containers` folder.

3. You can grab one of the templates from the `container-templates` folder to help you get an idea of what to contribute for different scenarios, but here's a quick summary of what you should include:

```
📁 <language>-<optional: version>-<descriptor>
📁 .vscode
📄 devContainer.json
📁 .devcontainer
📄 Dockerfile (optional)
📄 docker-compose.yml (optional)
📄 ignore
📁 test-project (optional)
📄 README.md
```

See [VS Code Remote's documentation](https://aka.ms/vscode-remote/docker) for information on the expected contents of `devContainer.json` and how it relates to other files listed above.

Note that any additional assets can be included as needed, but keep in mind that these will overlay on top of an existing project. Anything you don't want added to a project should be referenced in [glob](https://facelessuser.github.io/wcmatch/glob/) form in `.devcontainer/ignore` with paths relative to the location of the `ignore` file. Create a `README.md` in the folder with a brief description of the purpose of the container definition and any manual steps required to use it.

4. Commit your changes and submit a PR - we'll take a look at it, provide any needed feedback, and then merge it in! We appreciate any and all feedback!!

## Developing and testing a definition

VS Code Remote provides a straight forward development loop for creating and editing container definitions. Just follow these steps to get started:

1. Create a definition folder and open it in VS Code
2. Edit the contents of the definition
3. Run the **Remote: Reopen Folder in Container** command
4. If this fails, click "Open folder locally" in the dialog that appears and go to step 2
6. If it opens successfully but you don't like the contents, edit the contents from within the container and run the **Remote: Rebuild Container** command to make changes.

Note that if you make major changes, Docker may occasionally not pick up your edits. If this happens, you can delete the existing container and image, open the folder locally, and go to step 2 above. Install the [Docker extension](https://marketplace.visualstudio.com/items?itemName=PeterJausovec.vscode-docker) locally (when not in a container) to make this easy. While you can use Docker from inside a container by forwarding the Docker unix socket and installing the CLI in the container (see [Docker-in-Docker](containers/docker-in-docker)), you'll likely be removing the container you are actually using so this approach will not work well in this case.

Finally, after you get your container up and running, you can test it by adding test assets into the definition folder as long as they are referenced in the `.devcontainer/ignore` file in [glob](https://facelessuser.github.io/wcmatch/glob/) form ith paths relative to the location of the `ignore` file. By convention, most definitions place test assets in a `test-project` folder and this path is referenced in the template `ignore` files.

## Speeding up container provisioning

While using a `Dockerfile` is a convienent way to get going with a new container definition, this method can slow down the process of creating the dev container since it requires the image be built by anyone using it. If your definition is stable, we strongly reccomend building and publishing your image to [DockerHub](https://hub.docker.com) or [Azure Container Registry](https://azure.microsoft.com/en-us/services/container-registry/) instead.

Once you've published your container image, just update `devContainer.json` to reference the image instead of the `Dockerfile`. See `container-templates/image` for an example.

## License

Copyright (c) Microsoft Corporation. All rights reserved.<br />
Licensed under the MIT License. See [LICENSE](../LICENSE).
66 changes: 4 additions & 62 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ You can either:

- Run **Remote: Create Container Configuration File...** command in VS Code and pick a definition. The appropriate files will then be added to your project.

- Manually copy the contents of one of the `containers` sub-folders into your project. When manually copying, note that some definitions contain a `test-project` folder and/or `.vscode/launch.json`, `.vscode/settings.json`, or `.vscode/tasks.json` files. These and `README.md` and `.vscodeignore` can typically be omitted.
- Manually copy the contents of one of the `containers` sub-folders into your project. Copy the `.devcontainer` folder and `.vscode/devContainer.json` into your project and you should be ready to go!

## Adding a definition to an existing public or private repo

Expand All @@ -41,73 +41,15 @@ You can also optionally have VS Code recommend developers install the Remote Dev

## Contributing

Have a container set up you're proud of and would like to share? Want to see some changes made to an existing definition? This project welcomes contributions and suggestions. Most contributions require you to agree to a
Contributor License Agreement (CLA) declaring that you have the right to, and actually do, grant us
the rights to use your contribution. For details, visit https://cla.microsoft.com.
Find a bug? Have a suggestion? Have a container set up you're proud of and would like to share? Want to see some changes made to an existing definition? We love all contributions and suggestions! See [CONTRIBUTING.md](CONTRIBUTING.md) for details on what to do.

When you submit a pull request, a CLA-bot will automatically determine whether you need to provide
a CLA and decorate the PR appropriately (e.g., label, comment). Simply follow the instructions
provided by the bot. You will only need to do this once across all repos using our CLA.
## Code of Conduct

This project has adopted the [Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/).
For more information see the [Code of Conduct FAQ](https://opensource.microsoft.com/codeofconduct/faq/) or
contact [opencode@microsoft.com](mailto:opencode@microsoft.com) with any additional questions or comments.

### Contributing a definition

If you want to create a new definition:

1. Fork and clone this repository

2. Create a new folder in the `containers` directory. The name of the folder is effectively the **definition ID** and should follow the following format:

````
<language>-<optional: version>-<descriptor>
````

You'll find many examples in the current `containers` folder.

3. You can grab one of the templates from the `container-templates` folder to help you get an idea of what to contribute for different scenarios, but here's a quick summary of what you should include:

```
📁 <language>-<optional: version>-<descriptor>
📁 .vscode
📄 devContainer.json
📁 test-project (optional)
📄 dev-container.dockerfile (optional)
📄 docker-compose.dev-container.yml (optional)
📄 .vscodeignore
📄 README.md
```

See [VS Code Remote's documentation](https://aka.ms/vscode-remote/docker) for information on the expected contents of `devContainer.json` and how it relates to other files listed above.

Note that any additional assets can be included as needed, but keep in mind that these will overlay on top of an existing project. Anything you don't want added to a project should be referenced in [glob](https://facelessuser.github.io/wcmatch/glob/) form in `.vscodeignore`. Create a `README.md` in the folder with a brief description of the purpose of the container definition and any manual steps required to use it.

4. Commit your changes and submit a PR - we'll take a look at it, provide any needed feedback, and then merge it in! We appreciate any and all feedback!!

### Developing and testing a definition

VS Code Remote provides a straight forward development loop for creating and editing container definitions. Just follow these steps to get started:

1. Create a definition folder and open it in VS Code
2. Edit the contents of the definition
3. Run the **Remote: Reopen Folder in Container** command
4. If this fails, click "Open folder locally" in the dialog that appears and go to step 2
6. If it opens successfully but you don't like the contents, edit the contents from within the container and run the **Remote: Rebuild Container** command to make changes.

Note that if you make major changes, Docker may occasionally not pick up your edits. If this happens, you can delete the existing container and image, open the folder locally, and go to step 2 above. Install the [Docker extension](https://marketplace.visualstudio.com/items?itemName=PeterJausovec.vscode-docker) locally (when not in a container) to make this easy. While you can use Docker from inside a container by forwarding the Docker unix socket and installing the CLI in the container (see [Docker-in-Docker](containers/docker-in-docker)), you'll likely be removing the container you are actually using so this approach will not work well in this case.

Finally, after you get your container up and running, you can test it by adding test assets into the definition folder as long as they are referenced in the `.vscodeignore` file in [glob](https://facelessuser.github.io/wcmatch/glob/) form. By convention, most definitions place test assets in a `test-project` folder.

### Speeding up container provisioning

While using a `Dockerfile` is a convienent way to get going with a new container definition, this method can slow down the process of creating the dev container since it requires the image be built by anyone using it. If your definition is stable, we strongly reccomend building and publishing your image to [DockerHub](https://hub.docker.com) or [Azure Container Registry](https://azure.microsoft.com/en-us/services/container-registry/) instead.

Once you've published your container image, just update `devContainer.json` to reference the image instead of the `Dockerfile`. See `container-templates/image` for an example.

## License

Copyright (c) Microsoft Corporation. All rights reserved.

Copyright (c) Microsoft Corporation. All rights reserved. <br />
Licensed under the MIT License. See [LICENSE](LICENSE).
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ services:
your-service-name-here:
build:
context: .
dockerfile: dev-container.dockerfile # Using a Dockerfile is optional, but included for completeness.
dockerfile: Dockerfile # Using a Dockerfile is optional, but included for completeness.

ports:
- "3000:3000" # Application port to forward
Expand Down
6 changes: 6 additions & 0 deletions container-templates/docker-compose/.devcontainer/ignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
../README.md
../test-project
../.vscode/launch.json
../.vscode/launch.test.json
../.vscode/settings.json
../.vscode/tasks.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "Dev Container Definition Template - Docker Compose",
"dockerComposeFile": "docker-compose.dev-container.yml",
"dockerComposeFile": "../.devcontainer/docker-compose.yml",
"service": "your-service-name-here",
"volume": "app",
"extensions": [
Expand Down
2 changes: 1 addition & 1 deletion container-templates/dockerfile/.vscode/devContainer.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "Dev Container Definition Template - Dockerfile",
"dockerFile": "dev-container.dockerfile",
"dockerFile": "../.devcontainer/Dockerfile",
"appPort": 3000,
"extensions": [
"mutantdino.resourcemonitor"
Expand Down
6 changes: 0 additions & 6 deletions container-templates/dockerfile/.vscodeignore

This file was deleted.

6 changes: 6 additions & 0 deletions container-templates/image/.devcontainer/ignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
../README.md
../test-project
../.vscode/launch.json
../.vscode/launch.test.json
../.vscode/settings.json
../.vscode/tasks.json
6 changes: 0 additions & 6 deletions container-templates/image/.vscodeignore

This file was deleted.

6 changes: 6 additions & 0 deletions containers/azure-cli/.devcontainer/ignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
../README.md
../test-project
../.vscode/launch.json
../.vscode/launch.test.json
../.vscode/settings.json
../.vscode/tasks.json
2 changes: 1 addition & 1 deletion containers/azure-cli/.vscode/devContainer.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "Azure CLI",
"dockerFile": "dev-container.dockerfile",
"dockerFile": "../.devcontainer/Dockerfile",
"extensions": [
"ms-vscode.azurecli"
]
Expand Down
6 changes: 0 additions & 6 deletions containers/azure-cli/.vscodeignore

This file was deleted.

6 changes: 6 additions & 0 deletions containers/azure-functions-node-8/.devcontainer/ignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
../README.md
../test-project
../.vscode/launch.json
../.vscode/launch.test.json
../.vscode/settings.json
../.vscode/tasks.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "Azure Functions & Node.js",
"dockerFile": "dev-container.dockerfile",
"dockerFile": "../.devcontainer/Dockerfile",
"appPort": 7071,
"extensions": [
"ms-azuretools.vscode-azurefunctions"
Expand Down
6 changes: 0 additions & 6 deletions containers/azure-functions-node-8/.vscodeignore

This file was deleted.

6 changes: 6 additions & 0 deletions containers/azure-hdinsight-python-3/.devcontainer/ignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
../README.md
../test-project
../.vscode/launch.json
../.vscode/launch.test.json
../.vscode/settings.json
../.vscode/tasks.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "Azure HDInsight",
"dockerFile": "dev-container.dockerfile",
"dockerFile": "../devcontainer/Dockerfile",
"extensions": [
"mshdinsight.azure-hdinsight"
]
Expand Down
6 changes: 0 additions & 6 deletions containers/azure-hdinsight-python-3/.vscodeignore

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
../README.md
../test-project
../.vscode/launch.json
../.vscode/launch.test.json
../.vscode/settings.json
../.vscode/tasks.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "Azure Machine Learning",
"dockerFile": "dev-container.dockerfile",
"dockerFile": "../.devcontainer/Dockerfile",
"extensions": [
"ms-toolsai.vscode-ai"
],
Expand Down
6 changes: 0 additions & 6 deletions containers/azure-machine-learning-python-3/.vscodeignore

This file was deleted.

6 changes: 6 additions & 0 deletions containers/azure-terraform/.devcontainer/ignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
../README.md
../test-project
../.vscode/launch.json
../.vscode/launch.test.json
../.vscode/settings.json
../.vscode/tasks.json
2 changes: 1 addition & 1 deletion containers/azure-terraform/.vscode/devContainer.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "Azure Terraform",
"dockerFile": "dev-container.dockerfile",
"dockerFile": "../.devcontainer/Dockerfile",
"extensions": [
"mauve.terraform",
"ms-azuretools.azureterraform"
Expand Down
6 changes: 0 additions & 6 deletions containers/azure-terraform/.vscodeignore

This file was deleted.

6 changes: 6 additions & 0 deletions containers/cpp/.devcontainer/ignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
../README.md
../test-project
../.vscode/launch.json
../.vscode/launch.test.json
../.vscode/settings.json
../.vscode/tasks.json
2 changes: 1 addition & 1 deletion containers/cpp/.vscode/devContainer.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "C++",
"dockerFile": "dev-container.dockerfile",
"dockerFile": "../.devcontainer/Dockerfile",
"extensions": [
"ms-vscode.cpptools"
],
Expand Down
7 changes: 0 additions & 7 deletions containers/cpp/.vscodeignore

This file was deleted.

6 changes: 6 additions & 0 deletions containers/dart-web/.devcontainer/ignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
../README.md
../test-project
../.vscode/launch.json
../.vscode/launch.test.json
../.vscode/settings.json
../.vscode/tasks.json
2 changes: 1 addition & 1 deletion containers/dart-web/.vscode/devContainer.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "Dart",
"dockerFile": "dev-container.dockerfile",
"dockerFile": "../.devcontainer/Dockerfile",
"appPort": 8080,
"extensions": [
"dart-code.dart-code",
Expand Down
6 changes: 0 additions & 6 deletions containers/dart-web/.vscodeignore

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ services:
docker-in-docker:
build:
context: .
dockerfile: dev-container.dockerfile
dockerfile: Dockerfile
volumes:
- .:/app

Expand Down
6 changes: 6 additions & 0 deletions containers/docker-in-docker-compose/.devcontainer/ignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
../README.md
../test-project
../.vscode/launch.json
../.vscode/launch.test.json
../.vscode/settings.json
../.vscode/tasks.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "Docker-in-Docker",
"dockerComposeFile": "docker-compose.dev-container.yml",
"dockerComposeFile": "../.devcontainer/docker-compose.yml",
"service": "docker-in-docker",
"volume": "app",
"extensions": [
Expand Down
6 changes: 0 additions & 6 deletions containers/docker-in-docker-compose/.vscodeignore

This file was deleted.

Loading

0 comments on commit 3607475

Please sign in to comment.