未验证 提交 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 #!/usr/bin/env bash
set -euo pipefail 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() { main() {
cd "$(dirname "${0}")/../../.." cd "$(dirname "$0")/../../.."
source ./ci/lib.sh
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
}
run() {
echo "--- Spawning $container_name"
docker run \ docker run \
-it \ -it \
--name $container_name \ --rm \
"-v=$PWD:/code-server" \ -v "$PWD:/src" \
"-w=/code-server" \ -w /src \
"-p=127.0.0.1:8080:8080" \ -p 127.0.0.1:8080:8080 \
$(if [[ -t 0 ]]; then echo -it; fi) \ "$(docker_build ./ci/images/debian8)" \
"$container_name" "$@"
} }
build() { docker_build() {
echo "--- Building $container_name" docker build "$@" >&2
docker build -t $container_name ./ci/dev/image > /dev/null docker build -q "$@"
} }
main "$@" main "$@"
...@@ -46,14 +46,12 @@ yarn watch ...@@ -46,14 +46,12 @@ yarn watch
To develop inside of an isolated docker container: To develop inside of an isolated docker container:
```shell ```shell
./ci/dev/image/exec.sh ./ci/dev/image/exec.sh yarn
./ci/dev/image/exec.sh yarn vscode
root@12345:/code-server# yarn ./ci/dev/image/exec.sh yarn watch
root@12345:/code-server# yarn vscode
root@12345:/code-server# 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 If changes are made to the patch and you've built previously you must manually
reset VS Code then run `yarn vscode:patch`. reset VS Code then run `yarn vscode:patch`.
...@@ -78,7 +76,7 @@ node . ...@@ -78,7 +76,7 @@ node .
Build release packages (make sure you run `./ci/steps/release.sh` first): 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 # The standalone release is in ./release-standalone
# .deb, .rpm and the standalone archive are in ./release-packages # .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.
先完成此消息的编辑!
想要评论请 注册