Skip to content

Commit 9739246

Browse files
authored
Add Visual Studio Code Development Container (jekyll#8016)
Merge pull request 8016
1 parent 4a1f00e commit 9739246

File tree

4 files changed

+86
-1
lines changed

4 files changed

+86
-1
lines changed

.devcontainer/Dockerfile

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
#-------------------------------------------------------------------------------------------------------------
2+
# Copyright (c) Microsoft Corporation. All rights reserved.
3+
# Licensed under the MIT License. See https://go.microsoft.com/fwlink/?linkid=2090316 for license information.
4+
#-------------------------------------------------------------------------------------------------------------
5+
6+
FROM ruby:2
7+
8+
# Avoid warnings by switching to noninteractive
9+
ENV DEBIAN_FRONTEND=noninteractive
10+
11+
# This Dockerfile adds a non-root user with sudo access. Use the "remoteUser"
12+
# property in devcontainer.json to use it. On Linux, the container user's GID/UIDs
13+
# will be updated to match your local UID/GID (when using the dockerFile property).
14+
# See https://aka.ms/vscode-remote/containers/non-root-user for details.
15+
ARG USERNAME=vscode
16+
ARG USER_UID=1000
17+
ARG USER_GID=$USER_UID
18+
19+
# Configure apt and install packages
20+
RUN apt-get update \
21+
&& apt-get -y install --no-install-recommends apt-utils dialog locales 2>&1 \
22+
# Verify git, process tools installed
23+
&& apt-get -y install git openssh-client iproute2 procps lsb-release \
24+
#
25+
# Install ruby-debug-ide and debase
26+
&& gem install ruby-debug-ide \
27+
&& gem install debase \
28+
#
29+
# Install node.js
30+
&& apt-get -y install curl software-properties-common \
31+
&& curl -sL https://deb.nodesource.com/setup_13.x | bash - \
32+
&& apt-get -y install nodejs \
33+
#
34+
# Create a non-root user to use if preferred - see https://aka.ms/vscode-remote/containers/non-root-user.
35+
&& groupadd --gid $USER_GID $USERNAME \
36+
&& useradd -s /bin/bash --uid $USER_UID --gid $USER_GID -m $USERNAME \
37+
# [Optional] Add sudo support for the non-root user
38+
&& apt-get install -y sudo \
39+
&& echo $USERNAME ALL=\(root\) NOPASSWD:ALL > /etc/sudoers.d/$USERNAME\
40+
&& chmod 0440 /etc/sudoers.d/$USERNAME \
41+
#
42+
# Clean up
43+
&& apt-get autoremove -y \
44+
&& apt-get clean -y \
45+
&& rm -rf /var/lib/apt/lists/*
46+
47+
# Set the locale
48+
RUN sed -i -e 's/# en_US.UTF-8 UTF-8/en_US.UTF-8 UTF-8/' /etc/locale.gen && \
49+
dpkg-reconfigure --frontend=noninteractive locales && \
50+
update-locale LANG=en_US.UTF-8
51+
52+
ENV LANG en_US.UTF-8
53+
54+
# Switch back to dialog for any ad-hoc use of apt-get
55+
ENV DEBIAN_FRONTEND=dialog

.devcontainer/devcontainer.json

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
// For format details, see https://aka.ms/vscode-remote/devcontainer.json or this file's README at:
2+
// https://github.com/microsoft/vscode-dev-containers/tree/v0.101.1/containers/ruby-2
3+
{
4+
"name": "Ruby 2",
5+
"dockerFile": "Dockerfile",
6+
7+
// Set *default* container specific settings.json values on container create.
8+
"settings": {
9+
"terminal.integrated.shell.linux": "/bin/bash"
10+
},
11+
12+
// Add the IDs of extensions you want installed when the container is created.
13+
"extensions": [
14+
"rebornix.Ruby"
15+
]
16+
17+
// Use 'forwardPorts' to make a list of ports inside the container available locally.
18+
// "forwardPorts": [],
19+
20+
// Use 'postCreateCommand' to run commands after the container is created.
21+
"postCreateCommand": "bundle install",
22+
23+
// Uncomment to connect as a non-root user. See https://aka.ms/vscode-remote/containers/non-root.
24+
// "remoteUser": "vscode"
25+
26+
}

docs/_docs/contributing.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -152,6 +152,10 @@ script/cucumber features/blah.feature
152152
Both `script/test` and `script/cucumber` can be run without arguments to
153153
run its entire respective suite.
154154

155+
## Visual Studio Code Development Container
156+
157+
If you've got [Visual Studio Code](https://code.visualstudio.com/) with the [Remote Development Extension Pack](https://marketplace.visualstudio.com/items?itemName=ms-vscode-remote.vscode-remote-extensionpack) installed then simply opening this repository in Visual Studio Code and following the prompts to "Re-open In A Development Container" will get you setup and ready to go with a fresh environment with all the requirements installed.
158+
155159
## A thank you
156160

157161
Thanks! Hacking on Jekyll should be fun. If you find any of this hard to figure out, let us know so we can improve our process or documentation!

docs/_docs/installation.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,4 +19,4 @@ For detailed install instructions have a look at the guide for your operating sy
1919
* [macOS](/docs/installation/macos/)
2020
* [Ubuntu Linux](/docs/installation/ubuntu/)
2121
* [Other Linux distros](/docs/installation/other-linux)
22-
* [Windows](/docs/installation/windows/)
22+
* [Windows](/docs/installation/windows/)

0 commit comments

Comments
 (0)