Skip to content

Commit 29b6115

Browse files
authored
Adds dev container and docs (#1499)
1 parent 28e91ba commit 29b6115

File tree

3 files changed

+72
-0
lines changed

3 files changed

+72
-0
lines changed

ci/dev-image/Dockerfile

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

ci/dev-image/exec.sh

+49
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
#!/usr/bin/env bash
2+
# exec.sh opens an interactive bash session inside of a docker container
3+
# for improved isolation during development
4+
# if the container exists it is restarted if necessary, then reused
5+
6+
set -euo pipefail
7+
cd "$(dirname "$0")"
8+
9+
# Ensure submodules are cloned and up to date.
10+
git submodule update --init
11+
12+
container_name=code-server-dev
13+
14+
enter() {
15+
echo "--- Entering $container_name"
16+
docker exec -it $container_id /bin/bash
17+
}
18+
19+
run() {
20+
echo "--- Spawning $container_name"
21+
container_id=$(docker run \
22+
-it \
23+
--name $container_name \
24+
"-v=$PWD:/code-server" \
25+
"-w=/code-server" \
26+
"-p=127.0.0.1:8080:8080" \
27+
$([[ -t 0 ]] && echo -it || true) \
28+
$container_name)
29+
}
30+
31+
build() {
32+
echo "--- Building $container_name"
33+
cd ../../
34+
docker build -t $container_name -f ./ci/dev-image/Dockerfile . > /dev/null
35+
}
36+
37+
container_id=$(docker container inspect --format="{{.Id}}" $container_name 2> /dev/null) || true
38+
39+
if [ "$container_id" != "" ]; then
40+
echo "-- Starting container"
41+
docker start $container_id > /dev/null
42+
43+
enter
44+
exit 0
45+
fi
46+
47+
build
48+
run
49+
enter

doc/CONTRIBUTING.md

+10
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,16 @@ 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+
./ci/dev-image/exec.sh
17+
18+
root@12345:/code-server# yarn
19+
root@12345:/code-server# yarn vscode
20+
root@12345:/code-server# yarn watch
21+
```
22+
1323
Any changes made to the source will be live reloaded.
1424

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

0 commit comments

Comments
 (0)