Skip to content

Commit c54dbb3

Browse files
committed
add slides
1 parent 1171683 commit c54dbb3

File tree

3 files changed

+23
-17
lines changed

3 files changed

+23
-17
lines changed

.DS_Store

0 Bytes
Binary file not shown.

docs/devcontainers.md

Lines changed: 23 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ Workspace files are mounted from the local file system or copied or cloned into
99
<img src="../imgs/architecture-containers.png" alt="docker-cont">
1010
</a>
1111

12+
## Basic
1213
Let's create a bare-bones devcontainer for our python project. Create a new folder:
1314

1415
```bash
@@ -31,6 +32,7 @@ Now populate it with the following:
3132
```
3233
This will create a new devcontainer called "Research Environment" that will use the Dockerfile in the parent directory. It will also forward port 8888 to the host machine.
3334

35+
## Better
3436
This is very basic. We don't have much functionality here at all. And how do we even access the actual jupyter lab server? We don't even have the python extension installed in the container! We would also find that any changes to the the stuff inside the container would not be reflected in the host machine. So let's make our experience more enjoyable.
3537

3638
```json
@@ -83,13 +85,13 @@ Now we have **a lot** more functionality!
8385

8486
Let's look at exactly what is going on here:
8587

86-
1. Top-level configuration:
88+
**Top-level configuration**
8789
```json
8890
"name": "Research Environment",
8991
```
9092
This simply names your development container for easy identification.
9193

92-
2. Build configuration:
94+
**Build configuration**
9395
```json
9496
"build": {
9597
"dockerfile": "../Dockerfile",
@@ -100,15 +102,15 @@ This tells VS Code how to build the container:
100102
- `dockerfile`: Points to a Dockerfile one directory up from the devcontainer.json
101103
- `context`: Sets the build context to the parent directory - what stuff to include in the build
102104

103-
3. Features section:
105+
**Features section**
104106
```json
105107
"features": {
106108
"ghcr.io/devcontainers/features/git:1": {}
107109
}
108110
```
109111
This adds additional tools to your container. Here, it's installing Git from the GitHub Container Registry.
110112

111-
4. VS Code Customizations:
113+
**VS Code Customizations**
112114
```json
113115
"customizations": {
114116
"vscode": {
@@ -118,43 +120,47 @@ This adds additional tools to your container. Here, it's installing Git from the
118120
}
119121
```
120122
This configures VS Code-specific settings:
123+
121124
- Extensions installed automatically:
122-
- Python extension
123-
- Pylance (Python language server)
124-
- Black formatter
125-
- Jupyter notebook support
126-
- GitHub Copilot
125+
- Python extension
126+
- Pylance (Python language server)
127+
- Black formatter
128+
- Jupyter notebook support
129+
- GitHub Copilot
130+
127131
- VS Code settings configured:
128-
- Sets Python interpreter path
129-
- Enables linting
130-
- Uses Black for formatting
131-
- Enables format-on-save
132-
- Sets a line length ruler at 88 characters (Black's default)
132+
- Sets Python interpreter path
133+
- Enables linting
134+
- Uses Black for formatting
135+
- Enables format-on-save
136+
- Sets a line length ruler at 88 characters (Black's default)
133137

134138
We can add other dev tools here like mypy or itools or flake8.
135139

136-
1. Port Forwarding:
140+
**Port Forwarding**
137141
```json
138142
"forwardPorts": [8888]
139143
```
140144
Makes port 8888 (commonly used for Jupyter notebooks) available on your local machine.
141145

142-
1. Post-Creation Commands:
146+
**Post-Creation Commands**
143147
```json
144148
"postCreateCommand": "pip install -r requirements.txt"
145149
```
146150
Runs after the container is created - in this case, installing Python dependencies from requirements.txt.
147151

148-
1. Environment Variables:
152+
**Environment Variables**
149153
```json
150154
"remoteEnv": {
151155
"PYTHONPATH": "${containerWorkspaceFolder}"
152156
}
153157
```
154158
Sets environment variables in the container:
159+
155160
- Adds the workspace folder to Python's module search path, letting you import from any subdirectory
156161

157162
This configuration creates a fully-featured Python development environment with:
163+
158164
- Code formatting and linting
159165
- Jupyter notebook support
160166
- Git integration

docs/docker.pptx

1.28 MB
Binary file not shown.

0 commit comments

Comments
 (0)