From 4d0eb45c000ff123bf2a28cbe7af5329d3c08bf9 Mon Sep 17 00:00:00 2001 From: James Taylor Date: Thu, 20 Apr 2023 11:51:08 +0100 Subject: [PATCH] Add dev container Signed-off-by: James Taylor --- .devcontainer/devcontainer.json | 30 ++++++++++++++++++++++++++++++ .vscode/tasks.json | 27 +++++++++++++++++++++++++++ 2 files changed, 57 insertions(+) create mode 100644 .devcontainer/devcontainer.json create mode 100644 .vscode/tasks.json diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json new file mode 100644 index 00000000..6068c617 --- /dev/null +++ b/.devcontainer/devcontainer.json @@ -0,0 +1,30 @@ +// For format details, see https://aka.ms/devcontainer.json. For config options, see the +// README at: https://github.com/devcontainers/templates/tree/main/src/typescript-node +{ + "name": "Node.js & TypeScript", + // Or use a Dockerfile or Docker Compose file. More info: https://containers.dev/guide/dockerfile + "image": "mcr.microsoft.com/devcontainers/typescript-node:0-18", + + // Features to add to the dev container. More info: https://containers.dev/features. + // "features": {}, + + // Use 'forwardPorts' to make a list of ports inside the container available locally. + "forwardPorts": [ + 8000, + 9000 + ], + + "remoteUser": "node", + "mounts": [ + "source=${localWorkspaceFolderBasename}-node_modules,target=${containerWorkspaceFolder}/node_modules,type=volume" + ], + + // Use 'postCreateCommand' to run commands after the container is created. + "postCreateCommand": "sudo chown node node_modules && npm install" + + // Configure tool-specific properties. + // "customizations": {}, + + // Uncomment to connect as root instead. More info: https://aka.ms/dev-containers-non-root. + // "remoteUser": "root" +} diff --git a/.vscode/tasks.json b/.vscode/tasks.json new file mode 100644 index 00000000..3576303c --- /dev/null +++ b/.vscode/tasks.json @@ -0,0 +1,27 @@ +{ + // See https://go.microsoft.com/fwlink/?LinkId=733558 + // for the documentation about the tasks.json format + "version": "2.0.0", + "tasks": [ + { + "label": "Serve (Development)", + "type": "shell", + "command": "npm run develop", + "group": { + "kind": "build" + }, + "isBackground": true, + "problemMatcher": [] + }, + { + "label": "Serve", + "type": "shell", + "command": "npm run build && npm run serve", + "group": { + "kind": "build" + }, + "isBackground": true, + "problemMatcher": [] + } + ] +}