From 1558ff6daceb20566b545d122ff06d405785d177 Mon Sep 17 00:00:00 2001 From: Anmol Sethi Date: Thu, 27 Aug 2020 15:39:24 -0400 Subject: [PATCH] Streamline dev container workflow (#2014) --- ci/dev/image/Dockerfile | 13 ------------ ci/dev/image/exec.sh | 47 ++++++++++------------------------------- doc/CONTRIBUTING.md | 12 +++++------ 3 files changed, 16 insertions(+), 56 deletions(-) delete mode 100644 ci/dev/image/Dockerfile diff --git a/ci/dev/image/Dockerfile b/ci/dev/image/Dockerfile deleted file mode 100644 index 46f7c184..00000000 --- a/ci/dev/image/Dockerfile +++ /dev/null @@ -1,13 +0,0 @@ -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"] diff --git a/ci/dev/image/exec.sh b/ci/dev/image/exec.sh index ea208755..c443f1cc 100755 --- a/ci/dev/image/exec.sh +++ b/ci/dev/image/exec.sh @@ -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}")/../../.." + 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 \ -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 "$@" diff --git a/doc/CONTRIBUTING.md b/doc/CONTRIBUTING.md index a64ee8fb..a2b73276 100644 --- a/doc/CONTRIBUTING.md +++ b/doc/CONTRIBUTING.md @@ -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 ```