Skip to content

Commit 01d98f2

Browse files
committedSep 11, 2019
feat(devContainer): adding vscode's devcontainer configuration
1 parent 1f88780 commit 01d98f2

File tree

3 files changed

+71
-0
lines changed

3 files changed

+71
-0
lines changed
 

‎.devcontainer/Dockerfile

+41
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
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 node:lts
7+
8+
# Avoid warnings by switching to noninteractive
9+
ENV DEBIAN_FRONTEND=noninteractive
10+
11+
# Configure apt and install packages
12+
RUN apt-get update \
13+
&& apt-get -y install --no-install-recommends apt-utils dialog 2>&1 \
14+
#
15+
# Verify git and needed tools are installed
16+
&& apt-get -y install git iproute2 procps direnv vim less \
17+
#
18+
# Install eslint globally
19+
&& npm install -g eslint \
20+
#
21+
# Clean up
22+
&& apt-get autoremove -y \
23+
&& apt-get clean -y \
24+
&& rm -rf /var/lib/apt/lists/*
25+
26+
# Install Zsh, Oh-My-Zsh and plugins
27+
RUN sh -c "$(curl https://raw.githubusercontent.com/deluan/zsh-in-docker/master/zsh-in-docker.sh)" -- \
28+
-p git -p ssh-agent \
29+
-p https://github.com/zsh-users/zsh-autosuggestions \
30+
-p https://github.com/zsh-users/zsh-completions \
31+
-p https://github.com/zsh-users/zsh-history-substring-search \
32+
-p https://github.com/zdharma/fast-syntax-highlighting
33+
34+
# Override Powerlevel9(10)k prompt provided by zsh-in-docker
35+
RUN echo 'POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(root_indicator dir vcs status)' >> ~/.zshrc
36+
37+
# Configure direnv (https://direnv.net/)
38+
RUN echo '[ -f /workspaces/contentful-migrate/.envrc ] && eval "$(direnv hook zsh)"' >> ~/.zshrc
39+
40+
# Switch back to dialog for any ad-hoc use of apt-get
41+
ENV DEBIAN_FRONTEND=

‎.devcontainer/devcontainer.json

+29
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
// For format details, see https://aka.ms/vscode-remote/devcontainer.json or the definition README at
2+
// https://github.com/microsoft/vscode-dev-containers/tree/master/containers/javascript-node-lts
3+
{
4+
"name": "Node.js (latest LTS)",
5+
"dockerFile": "Dockerfile",
6+
"settings": {
7+
"terminal.integrated.shell.linux": "/usr/bin/zsh",
8+
"editor.formatOnSave": true,
9+
"[javascript]": {
10+
"editor.defaultFormatter": "esbenp.prettier-vscode"
11+
},
12+
"[json]": {
13+
"editor.defaultFormatter": "esbenp.prettier-vscode"
14+
}
15+
},
16+
"runArgs": [
17+
"--name",
18+
"vsc-contentful-migrate",
19+
"-v",
20+
"${env:HOME}${env:USERPROFILE}/.ssh:/root/.ssh-localhost:ro"
21+
],
22+
"postCreateCommand": "mkdir -p ~/.ssh && cp -r ~/.ssh-localhost/* ~/.ssh && chmod 700 ~/.ssh && chmod 600 ~/.ssh/*",
23+
"extensions": [
24+
"dbaeumer.vscode-eslint",
25+
"gruntfuggly.todo-tree",
26+
"eamodio.gitlens",
27+
"esbenp.prettier-vscode"
28+
]
29+
}

‎.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
.vscode
55
.DS_Store
66
.nvmrc
7+
.envrc
78
node_modules
89
migrations
910
coverage

0 commit comments

Comments
 (0)