The goal of this repo is to serve as a base dev container for a Deno application
The Visual Studio Code Remote - Containers extension lets you use a Docker container as a full-featured development environment. It allows you to open any folder or repository inside a container and take advantage of Visual Studio Code's full feature set. A
devcontainer.json
file in your project tells VS Code how to access (or create) a development container with a well-defined tool and runtime stack. This container can be used to run an application or to sandbox tools, libraries, or runtimes needed for working with a codebase.
- Docker Engine installed in our machine, more information here: https://docs.docker.com/get-docker/
- Clone this repo into your local machine
git clone git@github.com:fsschmitt/devcontainer-deno.git
-
Open Visual Studio Code on the repo base folder
-
Run the following command or the
Reopen in Container
popup:
>Remote-Containers: Reopen in Container
- Then a new window of VSCode will open and the container will be built and initialized. After this you'll be able to run any deno command within the container. (This will only take time on the first run or whenever the container needs to be rebuilt)
vscode ➜ /workspaces/devcontainer-deno (main ✗) $ deno --version
deno 1.6.3 (release, x86_64-unknown-linux-gnu)
v8 8.8.294
typescript 4.1.3
vscode ➜ /workspaces/devcontainer-deno (main ✗) $ deno run hello-world.ts
Check file:///workspaces/devcontainer-deno/hello-world.ts
Hello John
Hello Sarah
Hello Kai
Within the file .devcontainer/devcontainer.json
you are able to extend:
- Settings
// Set *default* container specific settings.json values on container create.
"settings": {
"terminal.integrated.shell.linux": "/bin/bash",
"deno.enable": true,
"deno.unstable": true,
"deno.lint": true
},
Check more settings configurations in the documentation.
- Extensions
// Add the IDs of extensions you want installed when the container is created.
"extensions": [
"ms-azuretools.vscode-docker",
"denoland.vscode-deno",
"ms-vscode.vscode-typescript-tslint-plugin",
"esbenp.prettier-vscode"
],
Find more extensions in the VSCode Marketplace
Within the file .devcontainer/Dockerfile
it is possible to add more tooling and dependencies built in to the docker image that will serve as your dev container.
For example, if we wanted to add wget
command into our dev container, we could achieve this by simply adding it at the end of the Dockerfile
:
RUN apt-get update && export DEBIAN_FRONTEND=noninteractive \
&& apt-get install -y wget
You can also run this directly on a gitpod by simply clicking this button: or click here:
More information or questions, feel free to open an issue or reach out: