Skip to content

Commit 5d5aafd

Browse files
author
Alan Christie
committed
feat: Simpler dev-container (no docker-in-docker)
1 parent c60efb3 commit 5d5aafd

File tree

2 files changed

+12
-16
lines changed

2 files changed

+12
-16
lines changed

.devcontainer/Dockerfile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,6 @@ RUN pip install -r /tmp/requirements.txt \
1414
&& curl -LO "https://dl.k8s.io/release/v${KUBECTL_VERSION}/bin/linux/${PLATFORM}/kubectl" \
1515
&& install -o root -g root -m 0755 kubectl /usr/local/bin/kubectl
1616

17-
# Set KUBECONFIG (to dev container default config)
18-
# The user can (and is encouraged to) change this
17+
# Set KUBECONFIG (to the dev container's default config).
18+
# The user can (and is encouraged to) change this from the terminal.
1919
ENV KUBECONFIG=/home/vscode/.kube/config

.devcontainer/devcontainer.json

Lines changed: 10 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// For format details, see https://aka.ms/devcontainer.json. For config options, see the
22
// README at: https://github.com/devcontainers/templates/tree/main/src/python
33
{
4-
"name": "Kubernetes Ansible Python",
4+
"name": "Kubernetes Ansible Projects",
55
"build": {
66
"dockerfile": "Dockerfile",
77
// Args is one of arm64 or amd64
@@ -10,31 +10,25 @@
1010
}
1111
},
1212
"features": {
13-
"ghcr.io/devcontainers/features/docker-in-docker:2": {
14-
"moby": true,
15-
"azureDnsAutoDetection": true,
16-
"installDockerBuildx": true,
17-
"installDockerComposeSwitch": true,
18-
"version": "latest",
19-
"dockerDashComposeVersion": "v2"
20-
},
2113
"ghcr.io/devcontainers/features/git:1": {
2214
"ppa": true,
2315
"version": "os-provided"
2416
}
2517
},
26-
// We mount bash history in an attempt to preserver history
27-
// between container restarts
18+
// The user will need a ~/k8s-config directory where, as a matter of style
19+
// we tend to keep our kubernetes configuration files. The user will also
20+
// need a ~/.kube directory.
21+
//
22+
// We mount bash history in an attempt to preserver history between container restarts
2823
// (see https://code.visualstudio.com/remote/advancedcontainers/persist-bash-history)
2924
//
30-
// The user will also need a ~/k8s-config directory (kubernetes config files)
31-
// as well as a ~/.kube directory
3225
"mounts": [
3326
"source=${localEnv:HOME}/.gitconfig,target=/home/vscode/.gitconfig,type=bind,consistency=cached",
3427
"source=${localEnv:HOME}/k8s-config,target=/home/vscode/k8s-config,type=bind,consistency=cached",
3528
"source=${localEnv:HOME}/.kube,target=/home/vscode/.kube,type=bind,consistency=cached",
3629
"source=projectname-bashhistory,target=/commandhistory,type=volume"
3730
],
31+
// Studio Code custom module/plugins to load.
3832
"customizations": {
3933
"vscode": {
4034
"extensions": [
@@ -44,7 +38,6 @@
4438
"eamodio.gitlens",
4539
"github.vscode-github-actions",
4640
"ms-kubernetes-tools.vscode-kubernetes-tools",
47-
"ms-python.vscode-pylance",
4841
"sourcery.sourcery",
4942
"streetsidesoftware.code-spell-checker",
5043
"trond-snekvik.simple-rst",
@@ -53,8 +46,11 @@
5346
]
5447
}
5548
},
49+
// Things to do once the container's available...
5650
"postCreateCommand": {
5751
"Fix Volume Permissions": "sudo chown -R $(whoami): /commandhistory"
5852
},
53+
// Do we expect to expose ports the user needs to connect to?
54+
// If so list them (as integers) here.
5955
"forwardPorts": []
6056
}

0 commit comments

Comments
 (0)