Skip to content

Streamline dev container workflow #2014

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Aug 27, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 0 additions & 13 deletions ci/dev/image/Dockerfile

This file was deleted.

47 changes: 11 additions & 36 deletions ci/dev/image/exec.sh
Original file line number Diff line number Diff line change
@@ -1,48 +1,23 @@
#!/usr/bin/env bash
set -euo pipefail

# Opens an interactive bash session inside of a docker container
# for improved isolation during development.
# If the container exists it is restarted if necessary, then reused.

main() {
cd "$(dirname "${0}")/../../.."

local container_name=code-server-dev

if docker inspect $container_name &> /dev/null; then
echo "-- Starting container"
docker start "$container_name" > /dev/null

enter
exit 0
fi

build
run
enter
}

enter() {
echo "--- Entering $container_name"
docker exec -it "$container_name" /bin/bash
}
cd "$(dirname "$0")/../../.."
source ./ci/lib.sh

run() {
echo "--- Spawning $container_name"
docker run \
-it \
--name $container_name \
"-v=$PWD:/code-server" \
"-w=/code-server" \
"-p=127.0.0.1:8080:8080" \
$(if [[ -t 0 ]]; then echo -it; fi) \
"$container_name"
--rm \
-v "$PWD:/src" \
-w /src \
-p 127.0.0.1:8080:8080 \
"$(docker_build ./ci/images/debian8)" \
"$@"
}

build() {
echo "--- Building $container_name"
docker build -t $container_name ./ci/dev/image > /dev/null
docker_build() {
docker build "$@" >&2
docker build -q "$@"
}

main "$@"
12 changes: 5 additions & 7 deletions doc/CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,14 +46,12 @@ yarn watch
To develop inside of an isolated docker container:

```shell
./ci/dev/image/exec.sh

root@12345:/code-server# yarn
root@12345:/code-server# yarn vscode
root@12345:/code-server# yarn watch
./ci/dev/image/exec.sh yarn
./ci/dev/image/exec.sh yarn vscode
./ci/dev/image/exec.sh yarn watch
```

Any changes made to the source will be live reloaded.
`yarn watch` will live reload changes to the source.

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

```
./ci/steps/release-packages.sh
./ci/dev/image/exec.sh ./ci/steps/release-packages.sh
# The standalone release is in ./release-standalone
# .deb, .rpm and the standalone archive are in ./release-packages
```
Expand Down