Skip to content

Commit 700aa71

Browse files
feat: devcontainer
1 parent 4aeb1a6 commit 700aa71

File tree

1 file changed

+76
-0
lines changed

1 file changed

+76
-0
lines changed

.devcontainer/devcontainer.json

Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
{
2+
"name": "PokeAPI",
3+
4+
// Use multiple docker-compose files for development and overrides
5+
"dockerComposeFile": [
6+
"../docker-compose.yml",
7+
"../docker-compose-dev.yml"
8+
],
9+
10+
// Target container service to attach VS Code workspace
11+
"service": "app",
12+
13+
// Folder inside container where workspace is mounted
14+
"workspaceFolder": "/code",
15+
16+
"customizations": {
17+
"vscode": {
18+
"settings": {
19+
"python.defaultInterpreterPath": "/usr/local/bin/python",
20+
21+
// Use bash as the default shell in the integrated terminal
22+
"terminal.integrated.profiles.linux": {
23+
"bash": {
24+
"path": "/bin/bash"
25+
}
26+
},
27+
"terminal.integrated.defaultProfile.linux": "bash",
28+
29+
// Enable automatic formatting on save with Black for Python files
30+
"[python]": {
31+
"editor.defaultFormatter": "ms-python.black-formatter",
32+
"editor.formatOnSave": true
33+
}
34+
},
35+
36+
// Extensions to install automatically in the container's VS Code instance
37+
"extensions": [
38+
"ms-python.python",
39+
"ms-python.black-formatter"
40+
]
41+
}
42+
},
43+
44+
// Post-create commands:
45+
// - Install essential tools (bash, git, make)
46+
// - Set Git line endings to input (avoid Windows-style CRLF issues)
47+
// - Run Django migrations with custom settings
48+
// - Run build data inside Django shell
49+
"postCreateCommand": "apk add --no-cache bash git make && git config --global core.autocrlf input && pip install black && python manage.py migrate --settings=config.docker-compose && echo \"from data.v2.build import build_all; build_all()\" | python manage.py shell --settings=config.docker-compose",
50+
51+
"remoteUser": "root",
52+
"overrideCommand": false,
53+
54+
// Ports to forward from container to host for easy access
55+
"forwardPorts": [80, 443, 8000, 8080],
56+
57+
// Custom port labels and auto-forward notification settings
58+
"portsAttributes": {
59+
"8000": {
60+
"label": "App",
61+
"onAutoForward": "notify"
62+
},
63+
"80": {
64+
"label": "Web HTTP",
65+
"onAutoForward": "notify"
66+
},
67+
"443": {
68+
"label": "Web HTTPS",
69+
"onAutoForward": "notify"
70+
},
71+
"8080": {
72+
"label": "GraphQL",
73+
"onAutoForward": "notify"
74+
}
75+
}
76+
}

0 commit comments

Comments
 (0)