Skip to content

Instantly share code, notes, and snippets.

@TechPreacher
Created May 7, 2025 09:33
Show Gist options
  • Select an option

  • Save TechPreacher/6fa929c19f01f4c23bb9fce1c5de128c to your computer and use it in GitHub Desktop.

Select an option

Save TechPreacher/6fa929c19f01f4c23bb9fce1c5de128c to your computer and use it in GitHub Desktop.

Strictly follow this gist and do not deviate from the structure. Analysis this repo and do not add additional packages not needed. For example, if this project is a .NET project, only add .NET related dependencies. If this project was a python project, only add python related dependencies.

DO NOT create a .devcontainer folder. Please use .devcontainer.json.

Your .devcontainer.json should contain the following:

{
	"name": "[PROJECT-NAME]",
	// Or use a Dockerfile or Docker Compose file. More info: https://containers.dev/guide/dockerfile
	"image": "mcr.microsoft.com/devcontainers/dotnet:1-8.0-bookworm",

	// Features to add to the dev container. More info: https://containers.dev/features.
	"features": {
		"ghcr.io/devcontainers/features/common-utils:2": {
			"installZsh": true,
			"configureZshAsDefaultShell": true,
			"installOhMyZsh": true,
			"upgradePackages": true,
			"username": "vscode",
			"userUid": "automatic",
			"userGid": "automatic"
		},
		"ghcr.io/devcontainers-contrib/features/zsh-plugins:0": {
			"plugins": "ssh-agent npm zsh-syntax-highlighting zsh-autosuggestions",
			"omzPlugins": "https://github.com/zsh-users/zsh-autosuggestions https://github.com/zsh-users/zsh-syntax-highlighting",
			"username": "vscode"
		},
		"ghcr.io/devcontainers/features/docker-outside-of-docker:1": {
			"version": "27.2.0",
			"moby": false
		},
		"ghcr.io/devcontainers/features/azure-cli:1": {}
	},

	// Configure tool-specific properties.
	"customizations": {
		// Configure properties specific to VS Code.
		"vscode": {
			"settings": {
				"files.insertFinalNewline": true,
					// Optional: Disable snippets, as they conflict with completion ranking.
					"editor.snippetSuggestions": "none"
				},
				"terminal.integrated.profiles.linux": {
					"zsh": {
						"path": "/usr/bin/zsh"
					}
				},
				"terminal.integrated.defaultProfile.linux": "zsh"
			},

			// Add the IDs of extensions you want installed when the container is created.
			"extensions": [
				"oderwat.indent-rainbow"
				"shardulm94.trailing-spaces",
				"timonwong.shellcheck",
				"github.copilot"
			]
		}
	},

	"runArgs": [
		"--cap-add=SYS_PTRACE",
		"--security-opt",
		"seccomp=unconfined",
		"--network=host"
	],
    
	//"forwardPorts": ["4201:4201"],   

	"remoteUser": "vscode"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment