Skip to content

Commit 3b3cb17

Browse files
committed
Adds dev container and docs
1 parent b78bdaf commit 3b3cb17

File tree

3 files changed

+62
-0
lines changed

3 files changed

+62
-0
lines changed

ci/dev.Dockerfile

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
FROM node:12
2+
3+
RUN apt-get update && \
4+
apt-get install -y curl iproute2 vim libgpgme-dev libdevmapper-dev iptables net-tools libsecret-1-dev libx11-dev libxkbfile-dev libxkbfile-dev
5+
6+
CMD ["/bin/bash"]

doc/CONTRIBUTING.md

+6
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,12 @@ yarn vscode
1010
yarn watch # Visit http://localhost:8080 once completed.
1111
```
1212

13+
To develop inside of an isolated docker container:
14+
15+
```shell
16+
./m bash -c 'yarn && yarn vscode && yarn watch' # Visit http://localhost:8080 once completed.
17+
```
18+
1319
Any changes made to the source will be live reloaded.
1420

1521
If changes are made to the patch and you've built previously you must manually

m

+50
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
#!/usr/bin/env bash
2+
3+
set -euo pipefail
4+
cd "$(dirname "$0")"
5+
6+
# Ensure submodules are cloned and up to date.
7+
git submodule update --init
8+
9+
container_name=code-server-dev
10+
11+
# Docker build is very verbose even when everything is cached.
12+
echo "--- Building $container_name"
13+
docker build -t $container_name -f ./ci/dev.Dockerfile . > /dev/null
14+
15+
set +e
16+
container_id=$(docker container inspect --format="{{.Id}}" $container_name 2>/dev/null)
17+
18+
if [ $? -eq "0" ]; then
19+
echo "--- Killing $container_name"
20+
docker rm -f $container_name 2>/dev/null
21+
fi
22+
set -e
23+
24+
echo "--- Spawning $container_name"
25+
container_id=$(docker run \
26+
-it \
27+
--privileged \
28+
--name $container_name \
29+
"-v=$PWD:/code-server" \
30+
"-w=/code-server" \
31+
"-p=8080:8080" \
32+
$([[ -t 0 ]] && echo -it || true) \
33+
-d \
34+
$container_name)
35+
36+
set +e
37+
38+
echo "--- Executing: $@"
39+
40+
CMD="$@"
41+
42+
docker exec \
43+
$([[ -t 0 ]] && echo -it || true) \
44+
$container_id \
45+
sh -c "$CMD"
46+
47+
docker exec \
48+
$([[ -t 0 ]] && echo -it || true) \
49+
$container_id \
50+
bash

0 commit comments

Comments
 (0)