Skip to content

Commit 01e4fcd

Browse files
author
Kevin
committed
feat: Add comprehensive Universal Docker Development Strategy with multi-language support
- Implemented a complete development environment using Docker, including a VS Code development container. - Created a Dockerfile for a multi-language backend with support for Python, Node.js, Go, Java, and Rust. - Developed a docker-compose file for a robust development stack including PostgreSQL, MySQL, Redis, MongoDB, Elasticsearch, and various admin interfaces. - Added a setup script for automatic environment configuration and dependency installation. - Documented the Universal Docker Development Strategy, detailing architecture, quick start instructions, available services, and troubleshooting tips. - Established a Makefile for consistent command usage across different project types.
1 parent 78dceb3 commit 01e4fcd

13 files changed

Lines changed: 3510 additions & 0 deletions

.devcontainer/devcontainer.json

Lines changed: 290 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,290 @@
1+
{
2+
"name": "Universal Development Environment",
3+
"dockerComposeFile": ["../docker/docker-compose.dev.yml", "../docker/docker-compose.devcontainer.yml"],
4+
"service": "vscode-dev",
5+
"workspaceFolder": "/workspace",
6+
"shutdownAction": "stopCompose",
7+
8+
// Configure VS Code settings
9+
"customizations": {
10+
"vscode": {
11+
"settings": {
12+
// Editor settings
13+
"editor.formatOnSave": true,
14+
"editor.codeActionsOnSave": {
15+
"source.fixAll": "explicit",
16+
"source.organizeImports": "explicit"
17+
},
18+
"editor.rulers": [80, 120],
19+
"editor.tabSize": 2,
20+
"editor.insertSpaces": true,
21+
"editor.detectIndentation": true,
22+
"editor.trimAutoWhitespace": true,
23+
"files.trimTrailingWhitespace": true,
24+
"files.insertFinalNewline": true,
25+
"files.trimFinalNewlines": true,
26+
27+
// Python settings
28+
"python.defaultInterpreterPath": "/usr/bin/python3",
29+
"python.formatting.provider": "black",
30+
"python.linting.enabled": true,
31+
"python.linting.pylintEnabled": true,
32+
"python.linting.flake8Enabled": true,
33+
"python.linting.mypyEnabled": true,
34+
"python.testing.pytestEnabled": true,
35+
"python.testing.unittestEnabled": false,
36+
"python.testing.nosetestsEnabled": false,
37+
38+
// JavaScript/TypeScript settings
39+
"typescript.preferences.quoteStyle": "single",
40+
"javascript.preferences.quoteStyle": "single",
41+
"eslint.validate": ["javascript", "typescript", "vue", "svelte"],
42+
"prettier.singleQuote": true,
43+
"prettier.semi": true,
44+
"prettier.trailingComma": "es5",
45+
46+
// Go settings
47+
"go.formatTool": "goimports",
48+
"go.lintTool": "golangci-lint",
49+
"go.testFlags": ["-v"],
50+
"go.coverOnSave": true,
51+
52+
// Rust settings
53+
"rust-analyzer.check.command": "clippy",
54+
"rust-analyzer.formatting.enable": true,
55+
56+
// Java settings
57+
"java.home": "/usr/lib/jvm/java-17-openjdk-amd64",
58+
"java.configuration.runtimes": [
59+
{
60+
"name": "JavaSE-17",
61+
"path": "/usr/lib/jvm/java-17-openjdk-amd64"
62+
}
63+
],
64+
65+
// Docker settings
66+
"docker.defaultRegistryPath": "localhost:5000",
67+
68+
// Git settings
69+
"git.autofetch": true,
70+
"git.enableSmartCommit": true,
71+
"git.confirmSync": false,
72+
73+
// Terminal settings
74+
"terminal.integrated.defaultProfile.linux": "bash",
75+
"terminal.integrated.profiles.linux": {
76+
"bash": {
77+
"path": "/bin/bash",
78+
"args": []
79+
},
80+
"zsh": {
81+
"path": "/bin/zsh",
82+
"args": []
83+
}
84+
},
85+
86+
// File associations
87+
"files.associations": {
88+
"*.dockerfile": "dockerfile",
89+
"Dockerfile.*": "dockerfile",
90+
"docker-compose*.yml": "dockercompose",
91+
"docker-compose*.yaml": "dockercompose",
92+
"*.env": "properties",
93+
"*.env.*": "properties"
94+
},
95+
96+
// Workspace settings
97+
"workbench.colorTheme": "Default Dark+",
98+
"workbench.iconTheme": "vs-seti",
99+
"workbench.startupEditor": "newUntitledFile",
100+
101+
// Security settings
102+
"security.workspace.trust.enabled": false
103+
},
104+
105+
// Essential extensions
106+
"extensions": [
107+
// Language support
108+
"ms-python.python",
109+
"ms-python.black-formatter",
110+
"ms-python.flake8",
111+
"ms-python.pylint",
112+
"ms-python.mypy-type-checker",
113+
"ms-vscode.vscode-typescript-next",
114+
"bradlc.vscode-tailwindcss",
115+
"golang.go",
116+
"rust-lang.rust-analyzer",
117+
"redhat.java",
118+
"vscjava.vscode-java-pack",
119+
120+
// Web development
121+
"ms-vscode.vscode-json",
122+
"esbenp.prettier-vscode",
123+
"dbaeumer.vscode-eslint",
124+
"stylelint.vscode-stylelint",
125+
"ms-vscode.vscode-css-languageservice",
126+
"formulahendry.auto-rename-tag",
127+
"christian-kohler.path-intellisense",
128+
129+
// Framework support
130+
"vue.volar",
131+
"svelte.svelte-vscode",
132+
"ms-vscode.vscode-node-azure-pack",
133+
"ms-vscode-remote.remote-containers",
134+
135+
// DevOps and Infrastructure
136+
"ms-azuretools.vscode-docker",
137+
"ms-kubernetes-tools.vscode-kubernetes-tools",
138+
"hashicorp.terraform",
139+
"ms-vscode.powershell",
140+
141+
// Database
142+
"ms-mssql.mssql",
143+
"ms-ossdata.vscode-postgresql",
144+
"mongodb.mongodb-vscode",
145+
"redis.redis-for-vscode",
146+
147+
// Testing
148+
"ms-vscode.test-adapter-converter",
149+
"hbenl.vscode-test-explorer",
150+
"ms-playwright.playwright",
151+
"ms-vscode.vscode-jest",
152+
153+
// Code quality and security
154+
"sonarqube.sonarqube-for-ide",
155+
"ms-vscode.vscode-security-scan",
156+
"ms-vscode.vscode-sarif-viewer",
157+
158+
// Git and version control
159+
"eamodio.gitlens",
160+
"mhutchie.git-graph",
161+
"donjayamanne.githistory",
162+
163+
// Documentation
164+
"yzhang.markdown-all-in-one",
165+
"shd101wyy.markdown-preview-enhanced",
166+
"davidanson.vscode-markdownlint",
167+
168+
// Productivity
169+
"ms-vscode.vscode-todo-highlight",
170+
"gruntfuggly.todo-tree",
171+
"alefragnani.bookmarks",
172+
"ms-vscode.vscode-fold-plus",
173+
"streetsidesoftware.code-spell-checker",
174+
175+
// Themes and icons
176+
"pkief.material-icon-theme",
177+
"zhuangtongfa.material-theme",
178+
"github.github-vscode-theme",
179+
180+
// Remote development
181+
"ms-vscode-remote.remote-ssh",
182+
"ms-vscode-remote.remote-ssh-edit",
183+
"ms-vscode-remote.remote-containers"
184+
]
185+
}
186+
},
187+
188+
// Forward ports
189+
"forwardPorts": [
190+
3000, // Frontend dev server
191+
3001, // Alternative frontend port
192+
5000, // Backend API
193+
5432, // PostgreSQL
194+
3306, // MySQL
195+
6379, // Redis
196+
27017, // MongoDB
197+
9200, // Elasticsearch
198+
5601, // Kibana
199+
8080, // Alternative backend port
200+
8081, // pgAdmin
201+
8082, // phpMyAdmin
202+
8083, // Redis Commander
203+
8084, // Mongo Express
204+
9000, // MinIO
205+
9001, // MinIO Console
206+
15672, // RabbitMQ Management
207+
8025, // Mailhog
208+
80, // NGINX
209+
443 // NGINX SSL
210+
],
211+
212+
// Post-create commands
213+
"postCreateCommand": "/workspace/.devcontainer/post-create.sh",
214+
215+
// Post-start commands
216+
"postStartCommand": "/workspace/.devcontainer/post-start.sh",
217+
218+
// Container user
219+
"remoteUser": "developer",
220+
221+
// Mount workspace
222+
"mounts": [
223+
"source=${localWorkspaceFolder},target=/workspace,type=bind,consistency=cached",
224+
"source=vscode-extensions,target=/home/developer/.vscode-server/extensions,type=volume",
225+
"source=vscode-settings,target=/home/developer/.vscode-server/data/User,type=volume",
226+
"source=bash-history,target=/home/developer/.bash_history,type=volume",
227+
"source=ssh-keys,target=/home/developer/.ssh,type=volume"
228+
],
229+
230+
// Environment variables
231+
"containerEnv": {
232+
"WORKSPACE_FOLDER": "/workspace",
233+
"NODE_ENV": "development",
234+
"PYTHONPATH": "/workspace/src",
235+
"GOPATH": "/workspace/go",
236+
"CARGO_HOME": "/workspace/.cargo",
237+
"JAVA_HOME": "/usr/lib/jvm/java-17-openjdk-amd64",
238+
"DOCKER_HOST": "unix:///var/run/docker.sock"
239+
},
240+
241+
// Override user ID and group ID
242+
"runArgs": [
243+
"--privileged",
244+
"--network=fll-sim-network"
245+
],
246+
247+
// Features to install
248+
"features": {
249+
"ghcr.io/devcontainers/features/common-utils:2": {
250+
"installZsh": true,
251+
"configureZshAsDefaultShell": true,
252+
"installOhMyZsh": true,
253+
"upgradePackages": true,
254+
"username": "developer",
255+
"userUid": "1000",
256+
"userGid": "1000"
257+
},
258+
"ghcr.io/devcontainers/features/git:1": {
259+
"ppa": true,
260+
"version": "latest"
261+
},
262+
"ghcr.io/devcontainers/features/docker-outside-of-docker:1": {
263+
"version": "latest",
264+
"enableNonRootDocker": true,
265+
"moby": true
266+
},
267+
"ghcr.io/devcontainers/features/node:1": {
268+
"nodeGypDependencies": true,
269+
"version": "20",
270+
"nvmVersion": "latest"
271+
},
272+
"ghcr.io/devcontainers/features/python:1": {
273+
"version": "3.12",
274+
"installTools": true,
275+
"optimize": true
276+
},
277+
"ghcr.io/devcontainers/features/go:1": {
278+
"version": "1.21"
279+
},
280+
"ghcr.io/devcontainers/features/rust:1": {
281+
"version": "latest",
282+
"profile": "default"
283+
},
284+
"ghcr.io/devcontainers/features/java:1": {
285+
"version": "17",
286+
"installMaven": true,
287+
"installGradle": true
288+
}
289+
}
290+
}

0 commit comments

Comments
 (0)