Skip to content

Commit e4ee4f4

Browse files
author
Alan Christie
committed
build: Add devcontainer configuration
1 parent f3eb169 commit e4ee4f4

File tree

3 files changed

+76
-0
lines changed

3 files changed

+76
-0
lines changed

.devcontainer/Dockerfile

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
FROM mcr.microsoft.com/devcontainers/python:1-3.13-bullseye
2+
3+
# The platform (CPU architectire)
4+
# if not provided by a build-arg we take a defult (ARM)
5+
ARG PLATFORM=amd64
6+
ENV PLATFORM=$PLATFORM
7+
8+
# kubectl
9+
ARG KUBECTL_VERSION=1.32.8
10+
RUN curl -LO "https://dl.k8s.io/release/v${KUBECTL_VERSION}/bin/linux/${PLATFORM}/kubectl" \
11+
&& install -o root -g root -m 0755 kubectl /usr/local/bin/kubectl

.devcontainer/devcontainer.json

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
// For format details, see https://aka.ms/devcontainer.json. For config options, see the
2+
// README at: https://github.com/devcontainers/templates/tree/main/src/python
3+
{
4+
"name": "WorkflowEngine DinD Python 3.13",
5+
"build": {
6+
"dockerfile": "Dockerfile",
7+
// Args is one of arm64 or amd64
8+
"args": {
9+
"PLATFORM": "${localEnv:PLATFORM:arm64}"
10+
}
11+
},
12+
"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+
},
21+
"ghcr.io/devcontainers/features/git:1": {
22+
"ppa": true,
23+
"version": "os-provided"
24+
}
25+
},
26+
// We mount bash history in an attempt to preserver history
27+
// between container restarts
28+
// (see https://code.visualstudio.com/remote/advancedcontainers/persist-bash-history)
29+
//
30+
// The user will also need a ~/k8s-config directory (kubernetes config files)
31+
"mounts": [
32+
"source=${localEnv:HOME}/.gitconfig,target=/home/vscode/.gitconfig,type=bind,consistency=cached",
33+
"source=${localEnv:HOME}/k8s-config,target=/k8s-config,type=bind,consistency=cached",
34+
"source=projectname-bashhistory,target=/commandhistory,type=volume"
35+
],
36+
"customizations": {
37+
"vscode": {
38+
"extensions": [
39+
"codezombiech.gitignore",
40+
"donjayamanne.githistory",
41+
"donjayamanne.git-extension-pack",
42+
"eamodio.gitlens",
43+
"github.vscode-github-actions",
44+
"ms-kubernetes-tools.vscode-kubernetes-tools",
45+
"ms-python.vscode-pylance",
46+
"sourcery.sourcery",
47+
"streetsidesoftware.code-spell-checker",
48+
"trond-snekvik.simple-rst",
49+
"vivaxy.vscode-conventional-commits",
50+
"yzhang.markdown-all-in-one"
51+
]
52+
}
53+
},
54+
"postCreateCommand": {
55+
"Install Python requirements": "pip3 install --user -r requirements.txt",
56+
"Install Pre-Commit": "pre-commit install -t commit-msg -t pre-commit",
57+
"Fix Volume Permissions": "sudo chown -R $(whoami): /commandhistory"
58+
},
59+
"forwardPorts": []
60+
}

requirements.txt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# Requirements file for the dev-container
2+
ansible >= 11.2.0
3+
kubernetes == 31.0.0
4+
poetry == 1.8.5
5+
pre-commit == 4.3.0

0 commit comments

Comments
 (0)