Skip to content

pmalacho-mit/devcontainers

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

167 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

devcontainers

Centralized, composable Dev Container configurations and tooling.

Source files in src/ are layered via extends and merged into ready‑to‑install single files in populated/.

Install a configuration into any repo with a one‑liner (see Install), and keep it up‑to‑date with a simple sync script (see containersync).

Why this is useful:

  • Consistent, reproducible environments across many projects and languages
  • Composable building blocks (customization.*, feature.*, image.*, mount.*) with deep merge
  • Opinionated VS Code settings and post-create automation baked in
  • One‑line install (no git history) via degit into .devcontainer/devcontainer.json
  • Easy updates: generated files carry a customizations.pmalacho-mit/devcontainers.ref you can resync with containersync

Install

Copy the appropriate command below into your project repository root to install a devcontainer configuration.

Each command uses the degit utility (from suede) to fetch the .devcontainer/devcontainer.json file from a specific branch of the pmalacho-mit/devcontainers repository.

The command structure:

  • bash <(curl https://suede.sh/utils/degit) — Downloads and executes the degit utility
  • --destination . — Extracts files to the current directory
  • --repo pmalacho-mit/devcontainers — Specifies the source repository
  • --branch <branch-name> — Specifies which devcontainer configuration branch to use
  • --force — Overwrites existing .devcontainer/devcontainer.json if present

devcontainer.common.json

bash <(curl https://suede.sh/utils/degit) --destination . --repo pmalacho-mit/devcontainers --branch common --force

devcontainer.docker-outside-of-docker.json

bash <(curl https://suede.sh/utils/degit) --destination . --repo pmalacho-mit/devcontainers --branch docker-outside-of-docker --force

devcontainer.node-default.json

bash <(curl https://suede.sh/utils/degit) --destination . --repo pmalacho-mit/devcontainers --branch node-default --force

devcontainer.poetry-default.json

bash <(curl https://suede.sh/utils/degit) --destination . --repo pmalacho-mit/devcontainers --branch poetry-default --force

devcontainer.python-default.json

bash <(curl https://suede.sh/utils/degit) --destination . --repo pmalacho-mit/devcontainers --branch python-default --force

devcontainer.svelte-default.json

bash <(curl https://suede.sh/utils/degit) --destination . --repo pmalacho-mit/devcontainers --branch svelte-default --force

devcontainer.svelte-docker-default.json

bash <(curl https://suede.sh/utils/degit) --destination . --repo pmalacho-mit/devcontainers --branch svelte-docker-default --force

devcontainer.svelte-tailwind-default.json

bash <(curl https://suede.sh/utils/degit) --destination . --repo pmalacho-mit/devcontainers --branch svelte-tailwind-default --force

devcontainer.typescript-default.json

bash <(curl https://suede.sh/utils/degit) --destination . --repo pmalacho-mit/devcontainers --branch typescript-default --force

devcontainer.typescript-docker-default.json

bash <(curl https://suede.sh/utils/degit) --destination . --repo pmalacho-mit/devcontainers --branch typescript-docker-default --force

Details

Full Configs (devcontainer.*.json)

Complete, composable devcontainer configurations that extend other files using the extends field.

devcontainer.common.json

Base configuration shared by all devcontainers. Includes common features, customizations, mounts, and post-create commands.

{
  "extends": [
    "./image.ubuntu-24.json",
    "./feature.git-subrepo.json",
    "./feature.vim.json",
    "./customization.tab-size-2.json",
    "./customization.format-on-save.json",
    "./customization.markdown.json",
    "./mount.ssh.json",
    "./opencode/initializeCommand.json",
    "./opencode/mount.json",
    "./opencode/postCreateCommand.json",
    "./postCreateCommand.ignore-UseKeychain-in-ssh-config.json",
    "./postCreateCommand.git-config-vim-as-core-editor.json",
    "./postCreateCommand.git-config-merge-divergent.json",
    "./postCreateCommand.codeblockify.json",
    "./postCreateCommand.containersync.json",
    "./difftastic/postCreateCommand.json"
  ]
}

devcontainer.node-default.json

Node.js-focused devcontainer with common Node setup.

{
  "extends": [
    "./devcontainer.common.json",
    "./feature.node-20.json"
  ]
}

devcontainer.python-default.json

Python-focused devcontainer with Python 3.12 and common Python tools.

{
  "extends": [
    "./devcontainer.common.json",
    "./feature.python-3.12.json",
    "./customization.python.json"
  ]
}

devcontainer.typescript-default.json

TypeScript/Node.js devcontainer with TypeScript compiler and Node.js 20.

{
  "extends": [
    "./devcontainer.node-default.json",
    "./customization.typescript.json"
  ]
}

devcontainer.svelte-default.json

Svelte-focused devcontainer with Svelte customizations and Node.js 20.

{
  "extends": [
    "./devcontainer.typescript-default.json",
    "./customization.svelte.json"
  ]
}

devcontainer.svelte-tailwind-default.json

Svelte with Tailwind CSS devcontainer, combining Svelte and Tailwind configurations.

{
  "extends": [
    "./devcontainer.svelte-default.json",
    "./customization.tailwindcss.json"
  ]
}

devcontainer.poetry-default.json

Python devcontainer with Poetry dependency management.

{
  "extends": [
    "./devcontainer.python-default.json",
    "./customization.python-venv.json",
    "./feature.poetry.json"
  ]
}

devcontainer.docker-outside-of-docker.json

Devcontainer configured to run Docker commands from within the container.

{
  "extends": [
    "./devcontainer.common.json",
    "./docker-outside-of-docker"
  ]
}

Customizations (customization.*.json)

VS Code editor customizations including settings, keybindings, and extensions.

customization.format-on-save.json

Enables automatic code formatting when saving files.

{
  "customizations": {
    "vscode": {
      "settings": {
        "editor.formatOnSave": true
      }
    }
  }
}

customization.markdown.json

VS Code customizations specific to Markdown editing.

{
  "customizations": {
    "vscode": {
      "settings": {
        "[markdown]": {
          "editor.defaultFormatter": null
        }
      }
    }
  }
}

customization.mermaid.json

Extensions and settings for Mermaid diagram support in VS Code.

{
  "customizations": {
    "vscode": {
      "extensions": [
        "bierner.markdown-mermaid"
      ]
    }
  }
}

customization.python.json

Python-specific VS Code customizations including linting and formatting tools.

{
  "customizations": {
    "vscode": {
      "settings": {
        "python.analysis.typeCheckingMode": "standard",
        "python.formatting.provider": "black",
        "python.formatting.blackArgs": [
          "--line-length=88"
        ],
        "[python]": {
          "editor.defaultFormatter": "ms-python.black-formatter"
        }
      },
      "extensions": [
        "ms-python.python",
        "ms-python.vscode-pylance",
        "ms-python.black-formatter"
      ]
    }
  }
}

customization.python-venv.json

Configures Python virtual environment detection and activation in VS Code.

{
  "customizations": {
    "vscode": {
      "settings": {
        "python.venvPath": "${containerWorkspaceFolder}/.venv",
        "python.defaultInterpreterPath": "${containerWorkspaceFolder}/.venv/bin/python",
        "python.terminal.activateEnvInCurrentTerminal": true
      }
    }
  }
}

customization.svelte.json

Svelte language support and formatting customizations for VS Code.

{
  "customizations": {
    "vscode": {
      "settings": {
        "svelte.enable-ts-plugin": true,
        "[svelte]": {
          "editor.defaultFormatter": "svelte.svelte-vscode"
        }
      },
      "extensions": [
        "svelte.svelte-vscode"
      ]
    }
  }
}

customization.tab-size-2.json

Sets default editor tab size to 2 spaces.

{
  "customizations": {
    "vscode": {
      "settings": {
        "editor.tabSize": 2
      }
    }
  }
}

customization.tailwindcss.json

Tailwind CSS IntelliSense and linting for VS Code.

{
  "customizations": {
    "vscode": {
      "extensions": [
        "bradlc.vscode-tailwindcss"
      ],
      "files.associations": {
        "*.css": "tailwindcss"
      }
    }
  }
}

customization.typescript.json

TypeScript-specific VS Code customizations including formatting and linting.

{
  "customizations": {
    "vscode": {
      "settings": {
        "[javascript]": {
          "editor.defaultFormatter": "esbenp.prettier-vscode"
        },
        "[typescript]": {
          "editor.defaultFormatter": "esbenp.prettier-vscode"
        }
      },
      "extensions": [
        "ms-vscode.vscode-typescript-next",
        "esbenp.prettier-vscode"
      ]
    }
  }
}

Features (feature.*.json)

Devcontainer Features that install tools and runtimes into the container.

feature.git-subrepo.json

Installs git-subrepo for managing git subrepositories.

{
  "features": {
    "ghcr.io/pmalacho-mit/devcontainer-features/git-subrepo:latest": {}
  }
}

feature.node-20.json

Installs Node.js 20.x runtime.

{
  "features": {
    "ghcr.io/devcontainers/features/node:latest": {
      "version": "20"
    }
  }
}

feature.poetry.json

Installs Poetry dependency manager for Python projects.

{
  "features": {
    "ghcr.io/devcontainers-extra/features/poetry:latest": {
      "version": "latest"
    }
  },
  "remoteEnv": {
    "POETRY_VIRTUALENVS_IN_PROJECT": "true"
  }
}

feature.postgres.json

Installs PostgreSQL database server.

{
  "features": {
    "ghcr.io/robbert229/devcontainer-features/postgresql-client:latest": {}
  }
}

feature.python-3.12.json

Installs Python 3.12 runtime.

{
  "features": {
    "ghcr.io/devcontainers/features/python:latest": {
      "version": "3.12"
    }
  }
}

feature.vim.json

Installs Vim editor.

{
  "features": {
    "ghcr.io/guiyomh/features/vim:0": {}
  }
}

Images (image.*.json)

Base container images for devcontainers.

image.ubuntu-24.json

Ubuntu 24.04 LTS base image.

{
  "image": "mcr.microsoft.com/devcontainers/base:ubuntu-24.04"
}

Mounts (mount.*.json)

Volume mounts that bind local directories into the container.

mount.ssh.json

Mounts the local SSH config and keys into the container for Git operations and remote access.

Important

If you're using MacOS, ensure to also include postCreateCommand.ignore-UseKeychain-in-ssh-config.json to avoid issues.

{
  "mounts": [
    "source=${localEnv:HOME}${localEnv:USERPROFILE}/.ssh,target=/home/vscode/.ssh,type=bind,consistency=cached"
  ]
}

Post Create Commands (postCreateCommand.*.json)

Commands executed automatically after the devcontainer is created, used for setup and configuration.

postCreateCommand.codeblockify.json

Installs the codeblockify utility for converting files into Markdown code blocks.

{
  "postCreateCommand": "sudo curl -fsSL https://gist.githubusercontent.com/pmalacho-mit/d64caa8e16b0b0fdd5e58cc37a0ce242/raw/8f0f620d4a65f6f3d930ea14e7c2fdf382ef1bf1/codeblockify.sh -o /usr/local/bin/codeblockify && sudo chmod +x /usr/local/bin/codeblockify"
}

postCreateCommand.containersync.json

Installs the containersync utility for syncing local devcontainer configs from the remote repository.

To update your .devcontainer/devcontainer.json to the latest version from pmalacho-mit/devcontainers, simply run the following in your devcontainer's terminal (at the root of your project):

containersync

{
  "postCreateCommand": "sudo curl -fsSL https://raw.githubusercontent.com/pmalacho-mit/devcontainers/main/scripts/sync.sh -o /usr/local/bin/containersync && sudo chmod +x /usr/local/bin/containersync"
}

postCreateCommand.git-config-merge-divergent.json

Configures Git to use merge (instead of rebase) when pulling divergent branches.

{
  "postCreateCommand": "git config pull.rebase false"
}

postCreateCommand.git-config-vim-as-core-editor.json

Configures Vim as the default Git editor.

{
  "postCreateCommand": "git config core.editor '/usr/bin/vim'"
}

postCreateCommand.ignore-UseKeychain-in-ssh-config.json

Adds IgnoreUnknown UseKeychain to SSH config for compatibility with non-macOS systems.

Used in tandem with mount.ssh.json.

{
  "postCreateCommand": "(grep -q 'IgnoreUnknown UseKeychain' ~/.ssh/config 2>/dev/null || sed -i '/UseKeychain/i IgnoreUnknown UseKeychain' ~/.ssh/config 2>/dev/null)"
}

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •  

Languages