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

Commit 9d193ad

Browse files
author
Shikanime
committed
Merge remote-tracking branch 'origin/master'
2 parents cdfd691 + 9c59fa4 commit 9d193ad

File tree

80 files changed

+743
-283
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

80 files changed

+743
-283
lines changed

.editorconfig

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
[*.json]
2+
indent_style = tab
3+
4+
[Dockerfile]
5+
indent_style = spaces
6+
indent_size = 4
7+
8+
[*.{yml,yaml}]
9+
indent_style = spaces
10+
indent_size = 2

.gitattributes

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
* text=auto eol=lf
2+
*.{cmd,[cC][mM][dD]} text eol=crlf
3+
*.{bat,[bB][aA][tT]} text eol=crlf

CONTRIBUTING.md

Lines changed: 33 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,26 @@ This document outlines a number of ways you can get involved.
44

55
## Contributing Dev Container Definitions
66

7-
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! 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.
7+
This repository contains a set of **dev container definitions** to help get you up and running with a containerized environment. The definitions describe the appropriate container image, runtime arguments for starting the container, and VS Code extensions that should be installed. They are intended to be dropped into an existing project or folder rather than acting as sample projects. (See the [vscode-remote-try-*](https://github.com/search?q=org%3Amicrosoft+vscode-remote-try-&type=Repositories) repositories if you are looking for sample projects.)
8+
9+
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! Read on to learn how.
10+
11+
### Anatomy of a Dev Container Definition
12+
13+
The contents of the folders in the `containers` directory ultimately populate the available definitions list shown in the **Remote-Containers: Create Container Configuration File...** command. To make this work, each folder consists of up to three things:
14+
15+
1. **The container definition itself** - These are the files and folders that will be added to a user's existing project / folder if they select the definition. Typically these files are stored in a `.devcontainer` folder.
16+
2. **Test assets** - While you are creating your definition, you may need to use a test project to make sure it works as expected. Contributing these files back will also help others that want to contribute to your definition in the future. These files are typically located in a `test-project` folder.
17+
3. **A `.npmignore` file** - This tells VS Code which files in the folder should be ignored when a user selects it for their project / folder. The file typically lists test assets or folders.
18+
19+
### Creating a new definition
20+
21+
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.
822

923
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.
1024

11-
If you want to create a new definition:
25+
26+
To create a new definition:
1227

1328
1. Fork and clone this repository
1429

@@ -37,29 +52,36 @@ If you want to create a new definition:
3752
3853
Note that any additional assets can be included as needed, but keep in mind that these will overlay on top of an existing project. Keeping these files in the `.devcontainer` folder should reduce the chances of something conflicting but note that any command that are run are relative to the root of the project, so you'll need to include `.devcontainer` in any path references.
3954
40-
VS Code respects [`.npmignore`](https://docs.npmjs.com/misc/developers#keeping-files-out-of-your-package) as a way to keep certain content out of projects when your definition is used. Add anything you don't want copied across into this file in [glob](https://facelessuser.github.io/wcmatch/glob/) form.
41-
4255
Finally, 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.
4356
44-
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!
57+
4. Update [`.npmignore`](https://docs.npmjs.com/misc/developers#keeping-files-out-of-your-package) if you've added new folders that should be excluded if used. Add anything you don't want copied in to a user's existing project / folder into this file in [glob](https://facelessuser.github.io/wcmatch/glob/) form.
4558
4659
### Developing and testing a definition
4760
4861
VS Code Remote provides a straight forward development loop for creating and editing container definitions. Just follow these steps to get started:
4962
5063
1. Create a definition folder and open it in VS Code
5164
2. Edit the contents of the definition
52-
3. Run the **Remote: Reopen Folder in Container** command
53-
4. If this fails, click "Open folder locally" in the dialog that appears and go to step 2
54-
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.
65+
3. Try it with `kbstyle(F1)` > **Remote-Containers: Reopen Folder in Container**.
66+
4. On failure:
67+
1. `kbstyle(F1)` > **Remote-Containers: Reopen Folder Locally**, which will open a new local window.
68+
2. In this local window: Edit the contents of the `.devcontainer` folder as required.
69+
3. Try it again: Go back to the container window, `kbstyle(F1)` > **Developer: Reload Window**.
70+
4. Repeat as needed.
71+
5. If the build was successful, but you want to make more changes:
72+
1. Edit the contents of the `.devcontainer` folder as required when connected to the container.
73+
2. `kbstyle(F1)` > **Remote-Containers: Rebuild Container**.
74+
3. On failure: Follow the same workflow above.
75+
76+
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
5577
56-
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.
78+
After you get your container up and running, you can test it by adding test assets / projects into the definition folder and then adding their locations to the `.npmignore` file in [glob](https://facelessuser.github.io/wcmatch/glob/) form relative to the root of the folder. By convention, most definitions place test assets in a `test-project` folder and this path is referenced in the template `.npmignore` files.
5779
58-
Finally, after you get your container up and running, you can test it by adding test assets into the definition folder and add them to the `.devcontainer/ignore` file in [glob](https://facelessuser.github.io/wcmatch/glob/) form relative to the root of the folder. By convention, most definitions place test assets in a `test-project` folder and this path is referenced in the template `ignore` files.
80+
Finally, 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!
5981
6082
### Speeding up container provisioning
6183
62-
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.
84+
While using a `Dockerfile` is a convenient 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 recommend 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.
6385
6486
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.
6587

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,9 @@
99
</td>
1010
</tr></table>
1111

12-
A **development container** is a running [Docker](https://www.docker.com) container with a well-defined tool/runtime stack and its prerequisites. The Remote - Containers extension in the [Remote Development](https://aka.ms/vscode-remote/download/extension) extension pack allows you to open any folder inside (or mounted into) a dev container and take advantage of VS Code's full development feature set.
12+
A **development container** is a running [Docker](https://www.docker.com) container with a well-defined tool/runtime stack and its prerequisites. The Remote - Containers extension in the [Remote Development](https://aka.ms/vscode-remote/download/extension) extension pack allows you to open any folder mounted into or inside a dev container and take advantage of VS Code's full development feature set.
1313

14-
This repository contains a set of **dev container definitions** to help get you up and running with a containerized environment. The definitions describe the appropriate container image, runtime arguments for starting the container, and VS Code extensions that should be installed. They can also be used as examples for adapting your own configuration to different situations.
14+
This repository contains a set of **dev container definitions** to help get you up and running with a containerized environment. The definitions describe the appropriate container image, runtime arguments for starting the container, and VS Code extensions that should be installed. They are intended to be dropped into an existing project or folder rather than acting as sample projects. (See the [vscode-remote-try-*](https://github.com/search?q=org%3Amicrosoft+vscode-remote-try-&type=Repositories) repositories if you are looking for sample projects.)
1515

1616
## Using a definition
1717

@@ -35,7 +35,7 @@ Your team now has a consistent environment and tool-chain and new contributors o
3535

3636
## Testing a definition
3737

38-
If you want to test a definition before choosing one:
38+
Some dev container definitions include test assets. To test a definition:
3939

4040
1. If this is your first time creating a dev container, follow the [getting started steps](https://aka.ms/vscode-remote/containers/getting-started) to configure your machine.
4141
2. Browse the contents of the `containers` folder in this repository and pick one. Review the `README` to see if there are any manual setup steps before continuing.
Lines changed: 23 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,25 @@
11
{
2-
// "See https://aka.ms/vscode-remote/devcontainer.json for format details."
3-
"name": "Dev Container Definition Template - Docker Compose",
4-
"dockerComposeFile": "docker-compose.yml",
5-
"service": "your-service-name-here",
6-
"workspaceFolder": "/workspace",
7-
"shutdownAction": "stopCompose",
8-
"extensions": [
9-
"mutantdino.resourcemonitor"
10-
]
2+
// See https://aka.ms/vscode-remote/devcontainer.json for format details.
3+
"name": "Dev Container Definition Template - Docker Compose",
4+
5+
// Update the 'dockerComposeFile' list if you have more compose files or use different names.
6+
"dockerComposeFile": "docker-compose.yml",
7+
8+
// The 'service' property is the name of the service for the container that VS Code should
9+
// use. Update this value and .devcontainer/docker-compose.yml to the real service name.
10+
"service": "your-service-name-here",
11+
12+
// The optional 'workspaceFolder' property is the path VS Code should open by default when
13+
// connected. This is typically a volume mount in .devcontainer/docker-compose.yml
14+
"workspaceFolder": "/workspace",
15+
16+
// Add any extensions you want auto-installed here.
17+
"extensions": [],
18+
19+
// Update the value of this line to 'none' if you want to keep your containers running after VS Code shuts down.
20+
"shutdownAction": "stopCompose",
21+
22+
// Uncomment the next line to run commands after the container is created.
23+
// "postCreateCommand": ["uname -a"]
24+
1125
}

container-templates/docker-compose/.devcontainer/docker-compose.yml

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,11 @@ services:
99
# Using a Dockerfile is optional, but included for completeness.
1010
build:
1111
context: .
12-
dockerfile: .devcontainer/Dockerfile
12+
dockerfile: Dockerfile
1313

14-
# Application port(s) to expose
15-
ports:
16-
- "3000:3000"
14+
# Uncomment to expose one or more ports
15+
# ports:
16+
# - "3000:3000"
1717

1818
volumes:
1919
# This is where VS Code should expect to find your project's source code
@@ -23,6 +23,15 @@ services:
2323
# This lets you avoid setting up Git again in the container
2424
- ~/.gitconfig:/root/.gitconfig
2525

26-
# Overrides default command so things don't shut down after the process ends - useful for debugging
26+
# Uncomment the next line if you plan to install the Docker CLI. See the docker-in-docker-compose definition for details.
27+
# - /var/run/docker.sock:/var/run/docker.sock
28+
29+
# Uncomment the next four lines if you will use a ptrace-based debugger like C++, Go, and Rust.
30+
# cap_add:
31+
# - SYS_PTRACE
32+
# security_opt:
33+
# - seccomp:unconfined
34+
35+
# Overrides default command so things don't shut down after the process ends.
2736
command: sleep infinity
2837

Lines changed: 24 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,26 @@
11
{
2-
// "See https://aka.ms/vscode-remote/devcontainer.json for format details."
3-
"name": "Dev Container Definition Template - Dockerfile",
4-
"dockerFile": "Dockerfile",
5-
"appPort": 3000,
6-
"extensions": [
7-
"mutantdino.resourcemonitor"
8-
],
9-
"runArgs": []
2+
// See https://aka.ms/vscode-remote/devcontainer.json for format details.
3+
"name": "Dev Container Definition Template - Dockerfile",
4+
5+
// Update the 'dockerFile' property if you aren't using the standard 'Dockerfile' filename.
6+
"dockerFile": "Dockerfile",
7+
8+
// Use the optional 'appPort' property to publish any ports you want to access.
9+
"appPort": [],
10+
11+
// Add any extensions you want auto-installed here.
12+
"extensions": [],
13+
14+
// The optional 'runArgs' property can be used to specify additional runtime arguments.
15+
"runArgs": [
16+
// Uncomment the next line if you want to use Docker from the container. See the docker-in-docker definition for details.
17+
// "-v","/var/run/docker.sock:/var/run/docker.sock",
18+
19+
// Uncomment the next two lines if you will use a ptrace-based debugger like C++, Go, and Rust
20+
// "--cap-add=SYS_PTRACE",
21+
// "--security-opt", "seccomp=unconfined"
22+
],
23+
24+
// Uncomment the next line to run commands after the container is created.
25+
// "postCreateCommand": ["uname -a"]
1026
}
Lines changed: 24 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,26 @@
11
{
2-
// "See https://aka.ms/vscode-remote/devcontainer.json for format details."
3-
"name": "Dev Container Definition Template - Container Image",
4-
"image": "ubuntu:bionic",
5-
"appPort": 3000,
6-
"extensions": [
7-
"mutantdino.resourcemonitor"
8-
],
9-
"runArgs": []
2+
// See https://aka.ms/vscode-remote/devcontainer.json for format details.
3+
"name": "Dev Container Definition Template - Container Image",
4+
5+
// Update the 'image' property with your Docker image name.
6+
"image": "ubuntu:bionic",
7+
8+
// Use the optional 'appPort' property to publish any ports you want to access.
9+
"appPort": [],
10+
11+
// Add any extensions you want auto-installed here.
12+
"extensions": [],
13+
14+
// The optional 'runArgs' property can be used to specify additional runtime arguments.
15+
"runArgs": [
16+
// Uncomment the next line if you want to use Docker from the container. See the docker-in-docker definition for details.
17+
// "-v","/var/run/docker.sock:/var/run/docker.sock",
18+
19+
// Uncomment the next two lines if you will use a ptrace-based debugger like C++, Go, and Rust.
20+
// "--cap-add=SYS_PTRACE",
21+
// "--security-opt", "seccomp=unconfined"
22+
],
23+
24+
// Uncomment the next line to run commands after the container is created.
25+
// "postCreateCommand": ["uname -a"]
1026
}
Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
#-------------------------------------------------------------------------------------------------------------
2+
# Copyright (c) Microsoft Corporation. All rights reserved.
3+
# Licensed under the MIT License. See https://go.microsoft.com/fwlink/?linkid=2090316 for license information.
4+
#-------------------------------------------------------------------------------------------------------------
5+
6+
# Pick any base image, but if you select node, skip installing node. 😊
7+
FROM debian:9
8+
9+
# Configure apt
10+
ENV DEBIAN_FRONTEND=noninteractive
11+
RUN apt-get update \
12+
&& apt-get -y install --no-install-recommends apt-utils 2>&1
13+
14+
# Install git, required tools
15+
RUN apt-get install -y \
16+
git \
17+
curl \
18+
procps \
19+
unzip \
20+
apt-transport-https \
21+
ca-certificates \
22+
gnupg-agent \
23+
software-properties-common \
24+
lsb-release 2>&1
25+
26+
# [Optional] Install Node.js for Azure Cloud Shell support
27+
# Change the "lts/*" in the two lines below to pick a different version
28+
RUN curl -so- https://raw.githubusercontent.com/creationix/nvm/v0.34.0/install.sh | bash 2>&1 \
29+
&& /bin/bash -c "source $HOME/.nvm/nvm.sh \
30+
&& nvm install lts/* \
31+
&& nvm alias default lts/*" 2>&1
32+
33+
# [Optional] For local testing instead of cloud shell
34+
# Install Docker CE CLI.
35+
RUN curl -fsSL https://download.docker.com/linux/$(lsb_release -is | tr '[:upper:]' '[:lower:]')/gpg | apt-key add - 2>/dev/null \
36+
&& add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/$(lsb_release -is | tr '[:upper:]' '[:lower:]') $(lsb_release -cs) stable" \
37+
&& apt-get update \
38+
&& apt-get install -y docker-ce-cli
39+
40+
# [Optional] For local testing instead of cloud shell
41+
# Install the Azure CLI
42+
RUN echo "deb [arch=amd64] https://packages.microsoft.com/repos/azure-cli/ $(lsb_release -cs) main" > /etc/apt/sources.list.d/azure-cli.list \
43+
&& curl -sL https://packages.microsoft.com/keys/microsoft.asc | apt-key add - 2>/dev/null \
44+
&& apt-get update \
45+
&& apt-get install -y azure-cli
46+
47+
# Install Ansible
48+
RUN apt-get install -y libssl-dev libffi-dev python-dev python-pip \
49+
&& pip install ansible[azure]
50+
51+
# Clean up
52+
RUN apt-get autoremove -y \
53+
&& apt-get clean -y \
54+
&& rm -rf /var/lib/apt/lists/*
55+
ENV DEBIAN_FRONTEND=dialog
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
{
2+
"name": "Azure Ansible",
3+
"dockerFile": "Dockerfile",
4+
"extensions": [
5+
"vscoss.vscode-ansible",
6+
"redhat.vscode-yaml",
7+
"ms-vscode.azurecli"
8+
],
9+
"runArgs": [
10+
"-v",
11+
"/var/run/docker.sock:/var/run/docker.sock"
12+
],
13+
// Uncomment the next line if you want to publish any ports.
14+
// "appPort": [],
15+
// Uncomment the next line to run commands after the container is created.
16+
// "postCreateCommand": "ansible --version"
17+
}

0 commit comments

Comments
 (0)