Adds dev container and docs (#1499)
This commit is contained in:
parent
28e91ba70c
commit
29b6115c77
13
ci/dev-image/Dockerfile
Normal file
13
ci/dev-image/Dockerfile
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
FROM node:12
|
||||||
|
|
||||||
|
RUN apt-get update && apt-get install -y \
|
||||||
|
curl \
|
||||||
|
iproute2 \
|
||||||
|
vim \
|
||||||
|
iptables \
|
||||||
|
net-tools \
|
||||||
|
libsecret-1-dev \
|
||||||
|
libx11-dev \
|
||||||
|
libxkbfile-dev
|
||||||
|
|
||||||
|
CMD ["/bin/bash"]
|
49
ci/dev-image/exec.sh
Executable file
49
ci/dev-image/exec.sh
Executable file
@ -0,0 +1,49 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
# exec.sh 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
|
||||||
|
|
||||||
|
set -euo pipefail
|
||||||
|
cd "$(dirname "$0")"
|
||||||
|
|
||||||
|
# Ensure submodules are cloned and up to date.
|
||||||
|
git submodule update --init
|
||||||
|
|
||||||
|
container_name=code-server-dev
|
||||||
|
|
||||||
|
enter() {
|
||||||
|
echo "--- Entering $container_name"
|
||||||
|
docker exec -it $container_id /bin/bash
|
||||||
|
}
|
||||||
|
|
||||||
|
run() {
|
||||||
|
echo "--- Spawning $container_name"
|
||||||
|
container_id=$(docker run \
|
||||||
|
-it \
|
||||||
|
--name $container_name \
|
||||||
|
"-v=$PWD:/code-server" \
|
||||||
|
"-w=/code-server" \
|
||||||
|
"-p=127.0.0.1:8080:8080" \
|
||||||
|
$([[ -t 0 ]] && echo -it || true) \
|
||||||
|
$container_name)
|
||||||
|
}
|
||||||
|
|
||||||
|
build() {
|
||||||
|
echo "--- Building $container_name"
|
||||||
|
cd ../../
|
||||||
|
docker build -t $container_name -f ./ci/dev-image/Dockerfile . > /dev/null
|
||||||
|
}
|
||||||
|
|
||||||
|
container_id=$(docker container inspect --format="{{.Id}}" $container_name 2> /dev/null) || true
|
||||||
|
|
||||||
|
if [ "$container_id" != "" ]; then
|
||||||
|
echo "-- Starting container"
|
||||||
|
docker start $container_id > /dev/null
|
||||||
|
|
||||||
|
enter
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
build
|
||||||
|
run
|
||||||
|
enter
|
@ -10,6 +10,16 @@ yarn vscode
|
|||||||
yarn watch # Visit http://localhost:8080 once completed.
|
yarn watch # Visit http://localhost:8080 once completed.
|
||||||
```
|
```
|
||||||
|
|
||||||
|
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
|
||||||
|
```
|
||||||
|
|
||||||
Any changes made to the source will be live reloaded.
|
Any changes made to the source will be live reloaded.
|
||||||
|
|
||||||
If changes are made to the patch and you've built previously you must manually
|
If changes are made to the patch and you've built previously you must manually
|
||||||
|
Loading…
Reference in New Issue
Block a user