From cb5c1fa809c39397282c8b71cc27fae48bbe6ecd Mon Sep 17 00:00:00 2001 From: Bill Church Date: Sat, 27 Apr 2024 10:41:44 +0000 Subject: [PATCH] chore: update dev env --- .devcontainer/Dockerfile | 20 -------------------- .devcontainer/devcontainer.json | 27 ++++++++++++++++----------- .devcontainer/scripts/tools.sh | 12 ++++++++++++ 3 files changed, 28 insertions(+), 31 deletions(-) delete mode 100644 .devcontainer/Dockerfile create mode 100644 .devcontainer/scripts/tools.sh diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile deleted file mode 100644 index 5fe2e02..0000000 --- a/.devcontainer/Dockerfile +++ /dev/null @@ -1,20 +0,0 @@ -# [Choice] Node.js version (use -bullseye variants on local arm64/Apple Silicon): 18, 16, 14, 18-bullseye, 16-bullseye, 14-bullseye, 18-buster, 16-buster, 14-buster -ARG VARIANT=16-bullseye -FROM mcr.microsoft.com/vscode/devcontainers/typescript-node:${VARIANT} - -# [Optional] Uncomment this section to install additional OS packages. -# RUN apt-get update && export DEBIAN_FRONTEND=noninteractive \ -# && apt-get -y install --no-install-recommends - -RUN apt-get update && apt-get install gnupg2 -y - -RUN npm i --location=global release-please - -RUN useradd -ms /bin/bash vscode - -# [Optional] Uncomment if you want to install an additional version of node using nvm -# ARG EXTRA_NODE_VERSION=10 -# RUN su node -c "source /usr/local/share/nvm/nvm.sh && nvm install ${EXTRA_NODE_VERSION}" - -# [Optional] Uncomment if you want to install more global node packages -# RUN su node -c "npm install -g " \ No newline at end of file diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index da87caf..6a1227e 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -1,22 +1,27 @@ { "name": "Node.js & TypeScript", - "build": { - "dockerfile": "Dockerfile", - // Update 'VARIANT' to pick a Node version: 18, 16, 14. - // Append -bullseye or -buster to pin to an OS version. - // Use -bullseye variants on local on arm64/Apple Silicon. - "args": { - "VARIANT": "16-bullseye" - } - }, + "image": "mcr.microsoft.com/devcontainers/base:jammy", + "mounts": [ + "source=${localEnv:HOME}${localEnv:USERPROFILE}/.ssh/personal_id_rsa.pub,target=/home/vscode/.hostssh/id_rsa.pub,readonly,type=bind,consistency=cached" + ], + "features": { + "ghcr.io/devcontainers-contrib/features/node-asdf:0": {}, + }, // Configure tool-specific properties. "customizations": { // Configure properties specific to VS Code. "vscode": { // Add the IDs of extensions you want installed when the container is created. "extensions": [ - "dbaeumer.vscode-eslint" + "ms-vscode-remote.remote-containers", + "dbaeumer.vscode-eslint", + "GitHub.copilot", + "GitHub.copilot-chat", + "esbenp.prettier-vscode", + "rvest.vs-code-prettier-eslint", + "bierner.markdown-mermaid", + "stylelint.vscode-stylelint" ] } }, @@ -25,7 +30,7 @@ // "forwardPorts": [], // Use 'postCreateCommand' to run commands after the container is created. - // "postCreateCommand": "yarn install", + "postCreateCommand": "/bin/bash ./.devcontainer/scripts/tools.sh >> ~/post-create-tools.log", // Comment out to connect as root instead. More info: https://aka.ms/vscode-remote/containers/non-root. "remoteUser": "vscode" diff --git a/.devcontainer/scripts/tools.sh b/.devcontainer/scripts/tools.sh new file mode 100644 index 0000000..add4870 --- /dev/null +++ b/.devcontainer/scripts/tools.sh @@ -0,0 +1,12 @@ +#!/bin/bash + +mkdir -p ~/.ssh && \ + touch ~/.ssh/known_hosts && \ + sudo tee ~/.ssh/config > /dev/null << EOF +Host github.com + HostName github.com + PreferredAuthentications publickey + IdentityFile ~/.hostssh/id_rsa.pub +EOF + +sudo chown -R vscode:vscode ~/.ssh \ No newline at end of file