Match current template, add info on Features and image metadata (#62)
* Match current template, add info on Features and image metadata * Update * Fix typo * Fix typo * Remove bad comment about user name * Update portsAttributs ref * Remove otherPortsAttributes given the reference * Typo
This commit is contained in:
		@@ -1,30 +0,0 @@
 | 
				
			|||||||
# See here for image contents: https://github.com/microsoft/vscode-dev-containers/blob/v0.202.3/containers/python-3/.devcontainer/base.Dockerfile
 | 
					 | 
				
			||||||
# [Choice] Python version (use -bullseye variants on local arm64/Apple Silicon): 3, 3.9, 3.8, 3.7, 3.6, 3-bullseye, 3.9-bullseye, 3.8-bullseye, 3.7-bullseye, 3.6-bullseye, 3-buster, 3.9-buster, 3.8-buster, 3.7-buster, 3.6-buster
 | 
					 | 
				
			||||||
ARG VARIANT=3-bullseye
 | 
					 | 
				
			||||||
FROM mcr.microsoft.com/devcontainers/python:0-${VARIANT}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
# [Optional] Allow the vscode user to pip install globally w/o sudo
 | 
					 | 
				
			||||||
ENV PIP_TARGET=/usr/local/pip-global
 | 
					 | 
				
			||||||
ENV PYTHONPATH=${PIP_TARGET}:${PYTHONPATH}
 | 
					 | 
				
			||||||
ENV PATH=${PIP_TARGET}/bin:${PATH}
 | 
					 | 
				
			||||||
RUN if ! cat /etc/group | grep -e "^pip-global:" > /dev/null 2>&1; then groupadd -r pip-global; fi \
 | 
					 | 
				
			||||||
    && usermod -a -G pip-global vscode \
 | 
					 | 
				
			||||||
    && umask 0002 && mkdir -p ${PIP_TARGET} \
 | 
					 | 
				
			||||||
    && chown :pip-global ${PIP_TARGET} \
 | 
					 | 
				
			||||||
    && ( [ ! -f "/etc/profile.d/00-restore-env.sh" ] || sed -i -e "s/export PATH=/export PATH=\/usr\/local\/pip-global:/" /etc/profile.d/00-restore-env.sh )
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
# [Choice] Node.js version: none, lts/*, 16, 14, 12, 10
 | 
					 | 
				
			||||||
ARG NODE_VERSION="none"
 | 
					 | 
				
			||||||
RUN if [ "${NODE_VERSION}" != "none" ]; then su vscode -c "umask 0002 && . /usr/local/share/nvm/nvm.sh && nvm install ${NODE_VERSION} 2>&1"; fi
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
# [Optional] If your pip requirements rarely change, uncomment this section to add them to the image.
 | 
					 | 
				
			||||||
# COPY requirements.txt /tmp/pip-tmp/
 | 
					 | 
				
			||||||
# RUN pip3 --disable-pip-version-check --no-cache-dir install -r /tmp/pip-tmp/requirements.txt \
 | 
					 | 
				
			||||||
#    && rm -rf /tmp/pip-tmp
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
# [Optional] Uncomment this section to install additional OS packages.
 | 
					 | 
				
			||||||
# RUN apt-get update && export DEBIAN_FRONTEND=noninteractive \
 | 
					 | 
				
			||||||
#     && apt-get -y install --no-install-recommends <your-package-list-here>
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
# [Optional] Uncomment this line to install global node packages.
 | 
					 | 
				
			||||||
# RUN su vscode -c "source /usr/local/share/nvm/nvm.sh && npm install -g <your-package-here>" 2>&1
 | 
					 | 
				
			||||||
@@ -1,50 +1,20 @@
 | 
				
			|||||||
// For format details, see https://aka.ms/vscode-remote/devcontainer.json or this file's README at:
 | 
					// For format details, see https://aka.ms/devcontainer.json. For config options, see the
 | 
				
			||||||
// https://github.com/microsoft/vscode-dev-containers/tree/v0.202.3/containers/python-3
 | 
					// README at: https://github.com/devcontainers/templates/tree/main/src/python
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	"name": "Python 3",
 | 
						"name": "Python 3",
 | 
				
			||||||
	"build": {
 | 
						// Or use a Dockerfile or Docker Compose file. More info: https://containers.dev/guide/dockerfile
 | 
				
			||||||
		"dockerfile": "Dockerfile",
 | 
						"image": "mcr.microsoft.com/devcontainers/python:0-3.11",
 | 
				
			||||||
		"context": "..",
 | 
					
 | 
				
			||||||
		"args": { 
 | 
						// Features to add to the dev container. More info: https://containers.dev/features.
 | 
				
			||||||
			// Update 'VARIANT' to pick a Python version: 3, 3.9, 3.8, 3.7, 3.6.
 | 
						// "features": {},
 | 
				
			||||||
			// Append -bullseye or -buster to pin to an OS version.
 | 
					 | 
				
			||||||
			// Use -bullseye variants on local on arm64/Apple Silicon.
 | 
					 | 
				
			||||||
			"VARIANT": "3.9-bullseye",
 | 
					 | 
				
			||||||
			// Options
 | 
					 | 
				
			||||||
			"NODE_VERSION": "lts/*"
 | 
					 | 
				
			||||||
		}
 | 
					 | 
				
			||||||
	},
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
	// Configure tool-specific properties.
 | 
						// Configure tool-specific properties.
 | 
				
			||||||
	"customizations": {
 | 
						"customizations": {
 | 
				
			||||||
		// Configure properties specific to VS Code.
 | 
							// Configure properties specific to VS Code.
 | 
				
			||||||
		"vscode": {
 | 
							"vscode": {
 | 
				
			||||||
			// Set *default* container specific settings.json values on container create.
 | 
								"settings": {},
 | 
				
			||||||
			"settings": { 
 | 
					 | 
				
			||||||
				"terminal.integrated.profiles.linux": {
 | 
					 | 
				
			||||||
					"bash": {
 | 
					 | 
				
			||||||
						"path": "/bin/bash"
 | 
					 | 
				
			||||||
					}
 | 
					 | 
				
			||||||
				},
 | 
					 | 
				
			||||||
				"python.defaultInterpreterPath": "/usr/local/bin/python",
 | 
					 | 
				
			||||||
				"python.languageServer": "Default",
 | 
					 | 
				
			||||||
				"python.linting.enabled": true,
 | 
					 | 
				
			||||||
				"python.linting.pylintEnabled": true,
 | 
					 | 
				
			||||||
				"python.formatting.autopep8Path": "/usr/local/py-utils/bin/autopep8",
 | 
					 | 
				
			||||||
				"python.formatting.blackPath": "/usr/local/py-utils/bin/black",
 | 
					 | 
				
			||||||
				"python.formatting.yapfPath": "/usr/local/py-utils/bin/yapf",
 | 
					 | 
				
			||||||
				"python.linting.banditPath": "/usr/local/py-utils/bin/bandit",
 | 
					 | 
				
			||||||
				"python.linting.flake8Path": "/usr/local/py-utils/bin/flake8",
 | 
					 | 
				
			||||||
				"python.linting.mypyPath": "/usr/local/py-utils/bin/mypy",
 | 
					 | 
				
			||||||
				"python.linting.pycodestylePath": "/usr/local/py-utils/bin/pycodestyle",
 | 
					 | 
				
			||||||
				"python.linting.pydocstylePath": "/usr/local/py-utils/bin/pydocstyle",
 | 
					 | 
				
			||||||
				"python.linting.pylintPath": "/usr/local/py-utils/bin/pylint"
 | 
					 | 
				
			||||||
			},
 | 
					 | 
				
			||||||
			
 | 
					 | 
				
			||||||
			// Add the IDs of extensions you want installed when the container is created.
 | 
					 | 
				
			||||||
			"extensions": [
 | 
								"extensions": [
 | 
				
			||||||
				"ms-python.python",
 | 
									"streetsidesoftware.code-spell-checker"
 | 
				
			||||||
				"ms-python.vscode-pylance"
 | 
					 | 
				
			||||||
			]
 | 
								]
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
	},
 | 
						},
 | 
				
			||||||
@@ -52,7 +22,8 @@
 | 
				
			|||||||
	// Use 'forwardPorts' to make a list of ports inside the container available locally.
 | 
						// Use 'forwardPorts' to make a list of ports inside the container available locally.
 | 
				
			||||||
	// "forwardPorts": [9000],
 | 
						// "forwardPorts": [9000],
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	// Use 'portsAttributes' to set default properties for specific forwarded ports. More info: https://code.visualstudio.com/docs/remote/devcontainerjson-reference.
 | 
						// Use 'portsAttributes' to set default properties for specific forwarded ports. 
 | 
				
			||||||
 | 
						// More info: https://containers.dev/implementors/json_reference/#port-attributes
 | 
				
			||||||
	"portsAttributes": {
 | 
						"portsAttributes": {
 | 
				
			||||||
		"9000": {
 | 
							"9000": {
 | 
				
			||||||
			"label": "Hello Remote World",
 | 
								"label": "Hello Remote World",
 | 
				
			||||||
@@ -60,14 +31,9 @@
 | 
				
			|||||||
		}
 | 
							}
 | 
				
			||||||
	},
 | 
						},
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	// Use 'otherPortsAttributes' to configure any ports that aren't configured using 'portsAttributes'.
 | 
					 | 
				
			||||||
	// "otherPortsAttributes": {
 | 
					 | 
				
			||||||
	// 		"onAutoForward": "silent"
 | 
					 | 
				
			||||||
	// },
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	// Use 'postCreateCommand' to run commands after the container is created.
 | 
						// Use 'postCreateCommand' to run commands after the container is created.
 | 
				
			||||||
	"postCreateCommand": "pip3 install -r requirements.txt",
 | 
						"postCreateCommand": "pip3 install -r requirements.txt"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	// Comment out to connect as root instead. More info: https://aka.ms/vscode-remote/containers/non-root.
 | 
						// Uncomment to connect as root instead. More info: https://aka.ms/dev-containers-non-root.
 | 
				
			||||||
	"remoteUser": "vscode"
 | 
						// "remoteUser": "root"
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										19
									
								
								README.md
									
									
									
									
									
								
							
							
						
						
									
										19
									
								
								README.md
									
									
									
									
									
								
							@@ -2,7 +2,7 @@
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
[](https://vscode.dev/redirect?url=vscode://ms-vscode-remote.remote-containers/cloneInVolume?url=https://github.com/microsoft/vscode-remote-try-python)
 | 
					[](https://vscode.dev/redirect?url=vscode://ms-vscode-remote.remote-containers/cloneInVolume?url=https://github.com/microsoft/vscode-remote-try-python)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
A **development container** is a running [Docker](https://www.docker.com) container with a well-defined tool/runtime stack and its prerequisites. You can try out development containers with **[GitHub Codespaces](https://github.com/features/codespaces)** or **[Visual Studio Code Dev Containers](https://aka.ms/vscode-remote/containers)**.
 | 
					A **development container** is a running container with a well-defined tool/runtime stack and its prerequisites. You can try out development containers with **[GitHub Codespaces](https://github.com/features/codespaces)** or **[Visual Studio Code Dev Containers](https://aka.ms/vscode-remote/containers)**.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
This is a sample project that lets you try out either option in a few easy steps. We have a variety of other [vscode-remote-try-*](https://github.com/search?q=org%3Amicrosoft+vscode-remote-try-&type=Repositories) sample projects, too.
 | 
					This is a sample project that lets you try out either option in a few easy steps. We have a variety of other [vscode-remote-try-*](https://github.com/search?q=org%3Amicrosoft+vscode-remote-try-&type=Repositories) sample projects, too.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -12,8 +12,9 @@ This is a sample project that lets you try out either option in a few easy steps
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
### GitHub Codespaces
 | 
					### GitHub Codespaces
 | 
				
			||||||
Follow these steps to open this sample in a Codespace:
 | 
					Follow these steps to open this sample in a Codespace:
 | 
				
			||||||
1. Click the Code drop-down menu and select the **Open with Codespaces** option.
 | 
					1. Click the **Code** drop-down menu.
 | 
				
			||||||
1. Select **+ New codespace** at the bottom on the pane.
 | 
					2. Click on the **Codespaces** tab.
 | 
				
			||||||
 | 
					3. Click **Create codespace on main** .
 | 
				
			||||||
 | 
					
 | 
				
			||||||
For more information on creating your codespace, visit the [GitHub documentation](https://docs.github.com/en/free-pro-team@latest/github/developing-online-with-codespaces/creating-a-codespace#creating-a-codespace).
 | 
					For more information on creating your codespace, visit the [GitHub documentation](https://docs.github.com/en/free-pro-team@latest/github/developing-online-with-codespaces/creating-a-codespace#creating-a-codespace).
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -41,13 +42,14 @@ Follow these steps to open this sample in a container using the VS Code Dev Cont
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
Once you have this sample opened, you'll be able to work with it like you would locally.
 | 
					Once you have this sample opened, you'll be able to work with it like you would locally.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
> **Note:** This container runs as a non-root user with sudo access by default. Comment out `"remoteUser": "vscode"` in `.devcontainer/devcontainer.json` if you'd prefer to run as root.
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
Some things to try:
 | 
					Some things to try:
 | 
				
			||||||
 | 
					
 | 
				
			||||||
1. **Edit:**
 | 
					1. **Edit:**
 | 
				
			||||||
   - Open `app.py`
 | 
					   - Open `app.py`
 | 
				
			||||||
   - Try adding some code and check out the language features.
 | 
					   - Try adding some code and check out the language features.
 | 
				
			||||||
 | 
					   - Make a spelling mistake and notice it is detected. The [Code Spell Checker](https://marketplace.visualstudio.com/items?itemName=streetsidesoftware.code-spell-checker) extension was automatically installed because it is referenced in `.devcontainer/devcontainer.json`.
 | 
				
			||||||
 | 
					   - Also notice that utilities like `pylint` and the [Python](https://marketplace.visualstudio.com/items?itemName=ms-python.python) extension are installed. Tools are installed in the `mcr.microsoft.com/devcontainers/python` image and Dev Container settings and metadata are automatically picked up from [image labels](https://containers.dev/implementors/reference/#labels).
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
2. **Terminal:** 
 | 
					2. **Terminal:** 
 | 
				
			||||||
    - Press <kbd>ctrl</kbd>+<kbd>shift</kbd>+<kbd>\`</kbd> to open a terminal window.
 | 
					    - Press <kbd>ctrl</kbd>+<kbd>shift</kbd>+<kbd>\`</kbd> to open a terminal window.
 | 
				
			||||||
@@ -79,6 +81,13 @@ Some things to try:
 | 
				
			|||||||
   - Modify the `"onAutoForward"` attribute in your `portsAttributes` from `"notify"` to `"openBrowser"`.
 | 
					   - Modify the `"onAutoForward"` attribute in your `portsAttributes` from `"notify"` to `"openBrowser"`.
 | 
				
			||||||
   - Press <kbd>F1</kbd> and select the **Dev Containers: Rebuild Container** or **Codespaces: Rebuild Container** command so the modifications are picked up.  
 | 
					   - Press <kbd>F1</kbd> and select the **Dev Containers: Rebuild Container** or **Codespaces: Rebuild Container** command so the modifications are picked up.  
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					5. **Install Node.js using a Dev Container Feature:**
 | 
				
			||||||
 | 
					   - Press <kbd>F1</kbd> and select the **Dev Containers: Configure Container Features...** or **Codespaces: Configure Container Features...** command.
 | 
				
			||||||
 | 
					   - Type "node" in the text box at the top.
 | 
				
			||||||
 | 
					   - Check the check box next to "Node.js (via nvm) and yarn" (published by devcontainers) 
 | 
				
			||||||
 | 
					   - Click OK
 | 
				
			||||||
 | 
					   - Press <kbd>F1</kbd> and select the **Dev Containers: Rebuild Container** or **Codespaces: Rebuild Container** command so the modifications are picked up.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
### More samples
 | 
					### More samples
 | 
				
			||||||
 | 
					
 | 
				
			||||||
- [Tweeter App - Python and Django](https://github.com/Microsoft/python-sample-tweeterapp)
 | 
					- [Tweeter App - Python and Django](https://github.com/Microsoft/python-sample-tweeterapp)
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user