From 8a2d00440b14af28a8a25de6e9e87d08133f970e Mon Sep 17 00:00:00 2001 From: John Hollowell Date: Tue, 22 Nov 2022 03:36:23 +0000 Subject: [PATCH] Add devcontainer configuration devcontainers can be used by IDEs like VSCode to build the whole development environment in a container. This allows you to keep dependencies, build, and all development aspects separated from any development. It also allows contributors to instantly have a working, standardized development environment. It also allows cloud development tools like GitHub Codespaces be automatically setup with the desired environment. See https://containers.dev/ for more details --- .devcontainer/Dockerfile | 6 ++++++ .devcontainer/devcontainer.json | 27 +++++++++++++++++++++++++++ .devcontainer/setup.sh | 11 +++++++++++ 3 files changed, 44 insertions(+) create mode 100644 .devcontainer/Dockerfile create mode 100644 .devcontainer/devcontainer.json create mode 100755 .devcontainer/setup.sh diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile new file mode 100644 index 000000000..9f20426fc --- /dev/null +++ b/.devcontainer/Dockerfile @@ -0,0 +1,6 @@ +ARG VARIANT="16-buster" +FROM mcr.microsoft.com/vscode/devcontainers/javascript-node:${VARIANT} + +RUN npm install -g pnpm + +ENV PATH="${PATH}:./node_modules/.bin" diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json new file mode 100644 index 000000000..e547dd7ed --- /dev/null +++ b/.devcontainer/devcontainer.json @@ -0,0 +1,27 @@ +{ + "name": "homepage", + "build": { + "dockerfile": "Dockerfile", + "args": { + "VARIANT": "18-buster" + } + }, + "customizations": { + "vscode": { + "extensions": [ + "dbaeumer.vscode-eslint", + "mhutchie.git-graph", + "streetsidesoftware.code-spell-checker", + ], + "settings": { + "eslint.format.enable": true, + "eslint.lintTask.enable": true, + "eslint.packageManager": "pnpm" + } + } + }, + "postCreateCommand": ".devcontainer/setup.sh", + "forwardPorts": [ + 3000 + ] +} diff --git a/.devcontainer/setup.sh b/.devcontainer/setup.sh new file mode 100755 index 000000000..70bf96cfd --- /dev/null +++ b/.devcontainer/setup.sh @@ -0,0 +1,11 @@ +#!/usr/bin/env bash + +# Install Node packages +pnpm install + +# Copy in skeleton configuration if there is no existing configuration +if [ ! -d "config/" ]; then + echo "Adding skeleton config" + mkdir config/ + cp -r src/skeleton/* config +fi