Skip to content

Commit 30e1d48

Browse files
authored
devcontainer files
1 parent 315f940 commit 30e1d48

File tree

4 files changed

+83
-0
lines changed

4 files changed

+83
-0
lines changed

.devcontainer/Dockerfile

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
# See here for image contents: https://github.com/microsoft/vscode-dev-containers/tree/v0.238.1/containers/jekyll/.devcontainer/base.Dockerfile
2+
3+
# [Choice] Debian OS version (use bullseye on local arm64/Apple Silicon): bullseye, buster
4+
ARG VARIANT="2.7-bullseye"
5+
FROM mcr.microsoft.com/vscode/devcontainers/jekyll:0-${VARIANT}
6+
7+
# [Choice] Node.js version: none, lts/*, 16, 14, 12, 10
8+
ARG NODE_VERSION="none"
9+
RUN if [ "${NODE_VERSION}" != "none" ]; then su vscode -c "umask 0002 && . /usr/local/share/nvm/nvm.sh && nvm install ${NODE_VERSION} 2>&1"; fi
10+
11+
# [Optional] Uncomment this section to install additional OS packages.
12+
# RUN apt-get update && export DEBIAN_FRONTEND=noninteractive \
13+
# && apt-get -y install --no-install-recommends <your-package-list-here>
14+
15+
# [Optional] Uncomment this line to install global node packages.
16+
# RUN su vscode -c "source /usr/local/share/nvm/nvm.sh && npm install -g <your-package-here>" 2>&1

.devcontainer/devcontainer.json

+29
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
// For format details, see https://aka.ms/devcontainer.json. For config options, see the README at:
2+
// https://github.com/microsoft/vscode-dev-containers/tree/v0.238.1/containers/jekyll
3+
{
4+
"name": "Jekyll",
5+
"build": {
6+
"dockerfile": "Dockerfile",
7+
"args": {
8+
// Update 'VARIANT' to pick a Debian OS version: bullseye, buster
9+
// Use bullseye when on local arm64/Apple Silicon.
10+
"VARIANT": "bullseye",
11+
// Enable Node.js: pick the latest LTS version
12+
"NODE_VERSION": "none"
13+
}
14+
},
15+
16+
// Use 'forwardPorts' to make a list of ports inside the container available locally.
17+
"forwardPorts": [
18+
// Jekyll server
19+
4000,
20+
// Live reload server
21+
35729
22+
],
23+
24+
// Use 'postCreateCommand' to run commands after the container is created.
25+
"postCreateCommand": "sh .devcontainer/post-create.sh",
26+
27+
// Comment out to connect as root instead. More info: https://aka.ms/vscode-remote/containers/non-root.
28+
"remoteUser": "vscode"
29+
}

.devcontainer/post-create.sh

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
#!/bin/sh
2+
3+
# Install the version of Bundler.
4+
if [ -f Gemfile.lock ] && grep "BUNDLED WITH" Gemfile.lock > /dev/null; then
5+
cat Gemfile.lock | tail -n 2 | grep -C2 "BUNDLED WITH" | tail -n 1 | xargs gem install bundler -v
6+
fi
7+
8+
# If there's a Gemfile, then run `bundle install`
9+
# It's assumed that the Gemfile will install Jekyll too
10+
if [ -f Gemfile ]; then
11+
bundle install
12+
fi

.vscode/tasks.json

+26
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
{
2+
// See https://go.microsoft.com/fwlink/?LinkId=733558
3+
// for the documentation about the tasks.json format
4+
"version": "2.0.0",
5+
"tasks": [
6+
{
7+
"label": "Serve",
8+
"type": "shell",
9+
"command": "bundle exec jekyll serve --livereload",
10+
"group": {
11+
"kind": "test",
12+
"isDefault": true
13+
},
14+
"isBackground": true,
15+
},
16+
{
17+
"label": "Build",
18+
"type": "shell",
19+
"command": "bundle exec jekyll build",
20+
"group": {
21+
"kind": "build",
22+
"isDefault": true
23+
},
24+
}
25+
]
26+
}

0 commit comments

Comments
 (0)