未验证 提交 1558ff6d 编写于 作者: A Anmol Sethi 提交者: GitHub

Streamline dev container workflow (#2014)

上级 ceb2265b
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"]
#!/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 "$@"
......@@ -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`.
......@@ -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
```
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册