Skip to content

Commit 1558ff6

Browse files
authored
Streamline dev container workflow (#2014)
1 parent ceb2265 commit 1558ff6

File tree

3 files changed

+16
-56
lines changed

3 files changed

+16
-56
lines changed

ci/dev/image/Dockerfile

-13
This file was deleted.

ci/dev/image/exec.sh

+11-36
Original file line numberDiff line numberDiff line change
@@ -1,48 +1,23 @@
11
#!/usr/bin/env bash
22
set -euo pipefail
33

4-
# Opens an interactive bash session inside of a docker container
5-
# for improved isolation during development.
6-
# If the container exists it is restarted if necessary, then reused.
7-
84
main() {
9-
cd "$(dirname "${0}")/../../.."
10-
11-
local container_name=code-server-dev
12-
13-
if docker inspect $container_name &> /dev/null; then
14-
echo "-- Starting container"
15-
docker start "$container_name" > /dev/null
16-
17-
enter
18-
exit 0
19-
fi
20-
21-
build
22-
run
23-
enter
24-
}
25-
26-
enter() {
27-
echo "--- Entering $container_name"
28-
docker exec -it "$container_name" /bin/bash
29-
}
5+
cd "$(dirname "$0")/../../.."
6+
source ./ci/lib.sh
307

31-
run() {
32-
echo "--- Spawning $container_name"
338
docker run \
349
-it \
35-
--name $container_name \
36-
"-v=$PWD:/code-server" \
37-
"-w=/code-server" \
38-
"-p=127.0.0.1:8080:8080" \
39-
$(if [[ -t 0 ]]; then echo -it; fi) \
40-
"$container_name"
10+
--rm \
11+
-v "$PWD:/src" \
12+
-w /src \
13+
-p 127.0.0.1:8080:8080 \
14+
"$(docker_build ./ci/images/debian8)" \
15+
"$@"
4116
}
4217

43-
build() {
44-
echo "--- Building $container_name"
45-
docker build -t $container_name ./ci/dev/image > /dev/null
18+
docker_build() {
19+
docker build "$@" >&2
20+
docker build -q "$@"
4621
}
4722

4823
main "$@"

doc/CONTRIBUTING.md

+5-7
Original file line numberDiff line numberDiff line change
@@ -46,14 +46,12 @@ yarn watch
4646
To develop inside of an isolated docker container:
4747

4848
```shell
49-
./ci/dev/image/exec.sh
50-
51-
root@12345:/code-server# yarn
52-
root@12345:/code-server# yarn vscode
53-
root@12345:/code-server# yarn watch
49+
./ci/dev/image/exec.sh yarn
50+
./ci/dev/image/exec.sh yarn vscode
51+
./ci/dev/image/exec.sh yarn watch
5452
```
5553

56-
Any changes made to the source will be live reloaded.
54+
`yarn watch` will live reload changes to the source.
5755

5856
If changes are made to the patch and you've built previously you must manually
5957
reset VS Code then run `yarn vscode:patch`.
@@ -78,7 +76,7 @@ node .
7876
Build release packages (make sure you run `./ci/steps/release.sh` first):
7977

8078
```
81-
./ci/steps/release-packages.sh
79+
./ci/dev/image/exec.sh ./ci/steps/release-packages.sh
8280
# The standalone release is in ./release-standalone
8381
# .deb, .rpm and the standalone archive are in ./release-packages
8482
```

0 commit comments

Comments
 (0)