From bcb2609b182d80fe3b701e6455c2aab1e161c6c0 Mon Sep 17 00:00:00 2001 From: Andrey Antukh Date: Wed, 1 Jul 2020 10:38:18 +0200 Subject: [PATCH] :sparkles: Adapt devenv docker to new exporter app. --- docker/devenv/Dockerfile | 40 +++++++++++++++++++++++++++++++ docker/devenv/files/nginx.conf | 2 +- docker/devenv/files/start-tmux.sh | 16 +++++++++++-- exporter/.nvmrc | 1 + exporter/bin/wait-and-start | 16 +++++++++++++ 5 files changed, 72 insertions(+), 3 deletions(-) create mode 100644 exporter/.nvmrc create mode 100755 exporter/bin/wait-and-start diff --git a/docker/devenv/Dockerfile b/docker/devenv/Dockerfile index c2a8b9f1a..df999f963 100644 --- a/docker/devenv/Dockerfile +++ b/docker/devenv/Dockerfile @@ -37,6 +37,46 @@ RUN set -ex; \ ; \ rm -rf /var/lib/apt/lists/*; +RUN set -ex; \ + apt-get update && \ + apt-get install -yq \ + gconf-service \ + libasound2 \ + libatk1.0-0 \ + libatk-bridge2.0-0 \ + libcairo2 \ + libcups2 \ + libdbus-1-3 \ + libexpat1 \ + libfontconfig1 \ + libgcc1 \ + libgconf-2-4 \ + libgdk-pixbuf2.0-0 \ + libglib2.0-0 \ + libgtk-3-0 \ + libnspr4 \ + libpango-1.0-0 \ + libpangocairo-1.0-0 \ + libx11-6 \ + libx11-xcb1 \ + libxcb1 \ + libxcomposite1 \ + libxcursor1 \ + libxdamage1 \ + libxext6 \ + libxfixes3 \ + libxi6 \ + libxrandr2 \ + libxrender1 \ + libxss1 \ + libxtst6 \ + fonts-liberation \ + libappindicator1 \ + libnss3 \ + libgbm1 \ + ; \ + rm -rf /var/lib/apt/lists/*; + RUN apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 0xB1998361219BD9C9 && \ echo "deb http://repos.azulsystems.com/debian stable main" >> /etc/apt/sources.list.d/zulu.list && \ apt-get -qq update && \ diff --git a/docker/devenv/files/nginx.conf b/docker/devenv/files/nginx.conf index a16bf5c24..d893000e8 100644 --- a/docker/devenv/files/nginx.conf +++ b/docker/devenv/files/nginx.conf @@ -77,7 +77,7 @@ http { } location /export { - proxy_pass http://127.0.0.1:6061/; + proxy_pass http://127.0.0.1:6061; } location /playground { diff --git a/docker/devenv/files/start-tmux.sh b/docker/devenv/files/start-tmux.sh index b7a326965..172b3f552 100755 --- a/docker/devenv/files/start-tmux.sh +++ b/docker/devenv/files/start-tmux.sh @@ -8,16 +8,28 @@ pushd ~/uxbox/frontend/ rm -rf node_modules; npm ci; popd +pushd ~/uxbox/exporter/ +rm -rf node_modules; +npm ci; +popd tmux -2 new-session -d -s uxbox tmux new-window -t uxbox:1 -n 'shadow watch' tmux select-window -t uxbox:1 tmux send-keys -t uxbox 'cd uxbox/frontend' enter C-l -tmux send-keys -t uxbox 'shadow-cljs watch main' enter +tmux send-keys -t uxbox 'npx shadow-cljs watch main' enter -tmux new-window -t uxbox:2 -n 'backend' +tmux new-window -t uxbox:2 -n 'exporter' tmux select-window -t uxbox:2 +tmux send-keys -t uxbox 'cd uxbox/exporter' enter C-l +tmux send-keys -t uxbox 'npx shadow-cljs watch main' enter +tmux split-window -v +tmux send-keys -t uxbox 'cd uxbox/exporter' enter C-l +tmux send-keys -t uxbox './bin/wait-and-start' enter + +tmux new-window -t uxbox:3 -n 'backend' +tmux select-window -t uxbox:3 tmux send-keys -t uxbox 'cd uxbox/backend' enter C-l tmux send-keys -t uxbox './bin/start-dev' enter diff --git a/exporter/.nvmrc b/exporter/.nvmrc new file mode 100644 index 000000000..5cf73e424 --- /dev/null +++ b/exporter/.nvmrc @@ -0,0 +1 @@ +v12.18.2 \ No newline at end of file diff --git a/exporter/bin/wait-and-start b/exporter/bin/wait-and-start new file mode 100755 index 000000000..c5e640bdf --- /dev/null +++ b/exporter/bin/wait-and-start @@ -0,0 +1,16 @@ +#!/usr/bin/env bash + +set -e + +wait_file() { + local file="$1"; shift + local wait_seconds="${1:-10}"; shift # 10 seconds as default timeout + + until test $((wait_seconds--)) -eq 0 -o -f "$file" ; do sleep 1; done + + ((++wait_seconds)) +} + +wait_file "target/exporter.js" 120 && { + node target/exporter.js +}