Skip to content

Commit 9c37ebc

Browse files
authored
feat: add devcontainer support (#334)
* feat: add a devcontainer * fix: remove appPort * chore: remove commented out travis code * taken from https://gist.github.com/ob6160/525eb3c6684e5d7104e676c410495a70 * chore: upgrade node version for publish
1 parent 73a0b9a commit 9c37ebc

File tree

4 files changed

+73
-2
lines changed

4 files changed

+73
-2
lines changed

.devcontainer/Dockerfile

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
FROM node:12
2+
3+
# Avoid warnings by switching to noninteractive
4+
ENV DEBIAN_FRONTEND=noninteractive
5+
6+
# The node image comes with a base non-root 'node' user which this Dockerfile
7+
# gives sudo access. However, for Linux, this user's GID/UID must match your local
8+
# user UID/GID to avoid permission issues with bind mounts. Update USER_UID / USER_GID
9+
# if yours is not 1000. See https://aka.ms/vscode-remote/containers/non-root-user.
10+
ARG USER_UID=1000
11+
ARG USER_GID=$USER_UID
12+
13+
# Configure apt and install packages
14+
RUN apt-get update \
15+
&& apt-get -y install --no-install-recommends apt-utils dialog 2>&1 \
16+
#
17+
# Verify git and needed tools are installed
18+
&& apt-get install -y git procps \
19+
#
20+
# Remove outdated yarn from /opt and install via package
21+
# so it can be easily updated via apt-get upgrade yarn
22+
&& rm -rf /opt/yarn-* \
23+
&& rm -f /usr/local/bin/yarn \
24+
&& rm -f /usr/local/bin/yarnpkg \
25+
&& apt-get install -y curl apt-transport-https lsb-release \
26+
&& curl -sS https://dl.yarnpkg.com/$(lsb_release -is | tr '[:upper:]' '[:lower:]')/pubkey.gpg | apt-key add - 2>/dev/null \
27+
&& echo "deb https://dl.yarnpkg.com/$(lsb_release -is | tr '[:upper:]' '[:lower:]')/ stable main" | tee /etc/apt/sources.list.d/yarn.list \
28+
&& apt-get update \
29+
&& apt-get -y install --no-install-recommends yarn \
30+
#
31+
# Install eslint globally
32+
&& npm install -g eslint \
33+
#
34+
# Create a non-root user to use if preferred - see https://aka.ms/vscode-remote/containers/non-root-user.
35+
&& if [ "$USER_GID" != "1000" ]; then groupmod node --gid $USER_GID; fi \
36+
&& if [ "$USER_UID" != "1000" ]; then usermod --uid $USER_UID node; fi \
37+
# [Optional] Add sudo support for non-root users
38+
&& apt-get install -y sudo \
39+
&& echo node ALL=\(root\) NOPASSWD:ALL > /etc/sudoers.d/node \
40+
&& chmod 0440 /etc/sudoers.d/node \
41+
#
42+
# Clean up
43+
&& apt-get autoremove -y \
44+
&& apt-get clean -y \
45+
&& rm -rf /var/lib/apt/lists/*
46+
47+
# Switch back to dialog for any ad-hoc use of apt-get
48+
ENV DEBIAN_FRONTEND=

.devcontainer/devcontainer.json

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
{
2+
"name": "fork-ts-checker-webpack-plugin devcontainer",
3+
"dockerFile": "Dockerfile",
4+
5+
"user": "node",
6+
7+
// Comment out the next line to run as root instead. Linux users, update
8+
// Dockerfile with your user's UID/GID if not 1000.
9+
"runArgs": [ "-u", "node" ],
10+
11+
// Use 'settings' to set *default* container specific settings.json values on container create.
12+
// You can edit these settings after create using File > Preferences > Settings > Remote.
13+
"settings": {
14+
"terminal.integrated.shell.linux": "/bin/bash"
15+
},
16+
17+
// Specifies a command that should be run after the container has been created.
18+
"postCreateCommand": "yarn install",
19+
20+
"extensions": [
21+
"dbaeumer.vscode-eslint"
22+
]
23+
}

.gitattributes

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
* text=auto

.travis.yml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
os:
22
- linux
33
- osx
4-
# - windows - travis isn't windows ready yet; tests fail for meaningless reasons
54

65
language: node_js
76
node_js:
@@ -26,7 +25,7 @@ env:
2625
jobs:
2726
include:
2827
- stage: release
29-
node_js: 10
28+
node_js: 12
3029
script: skip
3130
deploy:
3231
provider: script

0 commit comments

Comments
 (0)