From 826cc7dbf6acbaf9f603bc2fe38c9a93301d4830 Mon Sep 17 00:00:00 2001 From: Spenser Black Date: Thu, 7 Sep 2023 09:27:13 -0400 Subject: [PATCH] Create devcontainer configuration (#6479) * Add basic devcontainer config * Use Dockerfile for devcontainer This is to install additional dependencies that don't come with base image. * Fetch test references These references are necessary for tests to work properly. * Depluralize * Add YAML VSCode extension Most peeps will be editing the YAML files so lets ensure a better experience * Move bootstrap to onCreateCommand This will allow the bootstrapping to be cached in the prebuild and save users a lot of time * Make arrays multi-line Co-authored-by: John Gardner --------- Co-authored-by: Colin Seymour Co-authored-by: Colin Seymour Co-authored-by: John Gardner --- .devcontainer/Dockerfile | 3 +++ .devcontainer/devcontainer.json | 28 ++++++++++++++++++++++++++++ .devcontainer/postCreate.sh | 3 +++ .gitattributes | 2 ++ 4 files changed, 36 insertions(+) create mode 100644 .devcontainer/Dockerfile create mode 100644 .devcontainer/devcontainer.json create mode 100755 .devcontainer/postCreate.sh create mode 100644 .gitattributes diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile new file mode 100644 index 000000000..19af29a28 --- /dev/null +++ b/.devcontainer/Dockerfile @@ -0,0 +1,3 @@ +# Available versions: https://github.com/devcontainers/images/tree/main/src/ruby +FROM mcr.microsoft.com/devcontainers/ruby +RUN apt update && apt install -y cmake diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json new file mode 100644 index 000000000..28fd6b4c4 --- /dev/null +++ b/.devcontainer/devcontainer.json @@ -0,0 +1,28 @@ +{ + "name": "Ruby", + "build": { + "dockerfile": "Dockerfile" + }, + "features": { + "ghcr.io/devcontainers/features/docker-in-docker:2": {}, + "ghcr.io/devcontainers/features/go:1": {} + }, + "customizations": { + "codespaces": { + "openFiles": [ + "CONTRIBUTING.md", + "lib/linguist/languages.yml" + ] + }, + "vscode": { + "extensions": [ + "EditorConfig.EditorConfig", + "rebornix.Ruby", + "redhat.vscode-yaml" + ] + } + }, + "onCreateCommand": "./script/bootstrap", + "postCreateCommand": ".devcontainer/postCreate.sh", + "remoteUser": "vscode" +} diff --git a/.devcontainer/postCreate.sh b/.devcontainer/postCreate.sh new file mode 100755 index 000000000..557682fc1 --- /dev/null +++ b/.devcontainer/postCreate.sh @@ -0,0 +1,3 @@ +#!/bin/sh +git remote add linguist https://github.com/github-linguist/linguist +git fetch linguist v2.0.0:v2.0.0 test/attributes:test/attributes test/master:test/master diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 000000000..cdeb6ce04 --- /dev/null +++ b/.gitattributes @@ -0,0 +1,2 @@ +# Fix syntax highlighting for devcontainer files +.devcontainer/*.json linguist-language=JSON-with-Comments