Skip to content

Commit b77e6ad

Browse files
HManiac74pre-commit-ci[bot]cclauss
authored
Add Docker devcontainer configuration files (TheAlgorithms#8887)
* Added Docker container configuration files * Update Dockerfile Copy and install requirements * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Updated Docker devcontainer configuration * Update requierements.txt * Update Dockerfile * Update Dockerfile * Update .devcontainer/devcontainer.json Co-authored-by: Christian Clauss <cclauss@me.com> * Update Dockerfile * Update Dockerfile. Add linebreak --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: Christian Clauss <cclauss@me.com>
1 parent a03b739 commit b77e6ad

File tree

2 files changed

+48
-0
lines changed

2 files changed

+48
-0
lines changed

.devcontainer/Dockerfile

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
# https://github.com/microsoft/vscode-dev-containers/blob/main/containers/python-3/README.md
2+
ARG VARIANT=3.11-bookworm
3+
FROM mcr.microsoft.com/vscode/devcontainers/python:${VARIANT}
4+
COPY requirements.txt /tmp/pip-tmp/
5+
RUN python3 -m pip install --upgrade pip \
6+
&& python3 -m pip install --no-cache-dir install ruff -r /tmp/pip-tmp/requirements.txt

.devcontainer/devcontainer.json

+42
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
{
2+
"name": "Python 3",
3+
"build": {
4+
"dockerfile": "Dockerfile",
5+
"context": "..",
6+
"args": {
7+
// Update 'VARIANT' to pick a Python version: 3, 3.10, 3.9, 3.8, 3.7, 3.6
8+
// Append -bullseye or -buster to pin to an OS version.
9+
// Use -bullseye variants on local on arm64/Apple Silicon.
10+
"VARIANT": "3.11-bookworm",
11+
}
12+
},
13+
14+
// Configure tool-specific properties.
15+
"customizations": {
16+
// Configure properties specific to VS Code.
17+
"vscode": {
18+
// Set *default* container specific settings.json values on container create.
19+
"settings": {
20+
"python.defaultInterpreterPath": "/usr/local/bin/python",
21+
"python.linting.enabled": true,
22+
"python.formatting.blackPath": "/usr/local/py-utils/bin/black",
23+
"python.linting.mypyPath": "/usr/local/py-utils/bin/mypy"
24+
},
25+
26+
// Add the IDs of extensions you want installed when the container is created.
27+
"extensions": [
28+
"ms-python.python",
29+
"ms-python.vscode-pylance"
30+
]
31+
}
32+
},
33+
34+
// Use 'forwardPorts' to make a list of ports inside the container available locally.
35+
// "forwardPorts": [],
36+
37+
// Use 'postCreateCommand' to run commands after the container is created.
38+
// "postCreateCommand": "pip3 install --user -r requirements.txt",
39+
40+
// Comment out to connect as root instead. More info: https://aka.ms/vscode-remote/containers/non-root.
41+
"remoteUser": "vscode"
42+
}

0 commit comments

Comments
 (0)