Dev container "image"
to Dockerfile converter
This is a simple Visual Studio Code extension to convert the "image"
property in a devcontainer.json to a Dockerfile.
A devcontainer.json is a structured JSON with Comments (jsonc) metadata format part of the Dev Container Specification. Tools can use it to store any needed configuration required to develop inside of local or cloud-based containerized coding.
Note: This extension supports your existing dev container configuration files and workflows. To actually create, build, and work within dev containers in VS Code, check out the Dev Containers extension, GitHub Codespaces, or the Dev Container Spec.
Running the extension
- Clone the repo:
git clone https://github.com/bamurtaugh/devcontainer-image-convert
- Open the repo in VS Code (stable or insiders):
code devcontainer-image-convert
or code-insiders devcontainer-image-convert
- Open VS Code terminal, run
npm install
F5
to run the extension
Development status
This extension is under active development.
Items left to be investigated or implemented are designated with TODO
in extension.ts. Here are the main ones:
- Better handle if Dockerfile already exists (rather than silently failing
- Give option to cancel or overwrite, and overwrite will replace existing contents rather than write same FROM contents again
- Open the Dockerfile automatically after creation (or provide an extension setting to open Dockerfile automatically)
Code Action Provider Sample
This extension is based off the Visual Studio Code Code Action Provider sample extension, which shows how to provide code actions in the editor. Code actions are used to implement quick fixes and refactoring in VS Code.
Contributing
Please feel free to contribute changes to this extension via issues or PRs in this repo.
Further reading
License
The Code Action Provider sample has the following license:
- Copyright (c) Microsoft Corporation. All rights reserved.
- Licensed under the MIT License.
You can find the license for this extension in this repo's LICENSE.md.