From 080cf73a6285834cc014619125bdc2f7ffc427ee Mon Sep 17 00:00:00 2001 From: Josh Buker Date: Tue, 11 Apr 2023 12:43:12 -0700 Subject: [PATCH] Add .devcontainer support (#342) --- .devcontainer/Dockerfile | 10 ++++++++++ .devcontainer/devcontainer.json | 29 +++++++++++++++++++++++++++++ .devcontainer/postcreate.sh | 4 ++++ .gitignore | 1 + 4 files changed, 44 insertions(+) create mode 100644 .devcontainer/Dockerfile create mode 100644 .devcontainer/devcontainer.json create mode 100644 .devcontainer/postcreate.sh diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile new file mode 100644 index 00000000..0b5583df --- /dev/null +++ b/.devcontainer/Dockerfile @@ -0,0 +1,10 @@ +# Which Ruby version to use. You may need to use a more restrictive version, +# e.g. `3.0` +ARG VARIANT=3.0 + +# Pull Microsoft's ruby devcontainer base image +FROM mcr.microsoft.com/devcontainers/ruby:${VARIANT} + +# Ensure we're running the latest bundler, as what ships with the Ruby image may +# not be current, and bundler will auto-downgrade to match the Gemfile.lock +RUN gem install bundler diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json new file mode 100644 index 00000000..f97d0a6b --- /dev/null +++ b/.devcontainer/devcontainer.json @@ -0,0 +1,29 @@ +{ + "name": "Ruby", + "build": { + "dockerfile": "Dockerfile" + }, + + // 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": [ + "rebornix.Ruby" + ] + } + }, + + // Set the environment variables + // "runArgs": ["--env-file",".env"], + + // Use 'forwardPorts' to make a list of ports inside the container available locally. + // "forwardPorts": [], + + // Use 'postCreateCommand' to run commands after the container is created. + "postCreateCommand": "bash .devcontainer/postcreate.sh", + + // Set `remoteUser` to `root` to connect as root instead. More info: https://aka.ms/vscode-remote/containers/non-root. + "remoteUser": "vscode" +} diff --git a/.devcontainer/postcreate.sh b/.devcontainer/postcreate.sh new file mode 100644 index 00000000..01da0d59 --- /dev/null +++ b/.devcontainer/postcreate.sh @@ -0,0 +1,4 @@ +#!/bin/bash + +bundle config set path vendor/bundle +bundle install --jobs=1 diff --git a/.gitignore b/.gitignore index ea821b4f..df897d3d 100644 --- a/.gitignore +++ b/.gitignore @@ -10,6 +10,7 @@ doc # bundler .bundle +vendor # jeweler generated pkg