From f09ed4aedbc7ab30588ab3f91ef4db5b13960bca Mon Sep 17 00:00:00 2001 From: ms Date: Fri, 27 May 2022 15:02:41 +0200 Subject: TypeScript Sandbox. Compile and run source passed at runtime. --- typescript/README | 9 +++------ typescript/container/Dockerfile | 7 +++++-- typescript/container/prepare.sh | 2 +- typescript/container/taler-config.js | 10 ---------- typescript/container/taler-config.sh | 6 ++++++ 5 files changed, 15 insertions(+), 19 deletions(-) delete mode 100755 typescript/container/taler-config.js create mode 100755 typescript/container/taler-config.sh (limited to 'typescript') diff --git a/typescript/README b/typescript/README index f0a9445..996ec7a 100644 --- a/typescript/README +++ b/typescript/README @@ -3,10 +3,7 @@ Building and running the image. 'cd' into 'container/' and run: $ podman build -t $tag . -After the build, run: -$ podman run [-it] [-v /host/path/to/config-file:/config.ts] $tag +Run it, passing a configuration expression: +$ podman run -it [-v /host/path/to/config-file:/config.ts] $tag -The "[-it]" part makes it interactive, although it won't -be possible to kill the container only with CTRL-C. If "-v" -is given, the contained application will read 'config-file' -and configure/launch Taler according to it. +Please, kill running container with 'podman kill'. diff --git a/typescript/container/Dockerfile b/typescript/container/Dockerfile index acea926..898aad1 100644 --- a/typescript/container/Dockerfile +++ b/typescript/container/Dockerfile @@ -37,7 +37,10 @@ RUN systemctl enable prepare # taler-config interprets - at runtime - the # TypeScript code that describes the deployment. -COPY taler-config.js . -RUN chmod +x taler-config.js +COPY taler-config.sh . +RUN chmod +x taler-config.sh + +# NOTE: should TS be installed from APT? +RUN npm install -g typescript CMD ["/sbin/init"] diff --git a/typescript/container/prepare.sh b/typescript/container/prepare.sh index e6b356a..7be811e 100644 --- a/typescript/container/prepare.sh +++ b/typescript/container/prepare.sh @@ -4,4 +4,4 @@ set -e su -c "createuser --superuser root && createdb taler" postgres -/taler-config.js +/taler-config.sh diff --git a/typescript/container/taler-config.js b/typescript/container/taler-config.js deleted file mode 100755 index 4d01bf8..0000000 --- a/typescript/container/taler-config.js +++ /dev/null @@ -1,10 +0,0 @@ -#!/usr/bin/nodejs - -var fs = require("fs") - -try { - const data = fs.readFileSync("/config.ts", "utf-8"); - console.log(data); -} catch (error) { - console.log(error); -} diff --git a/typescript/container/taler-config.sh b/typescript/container/taler-config.sh new file mode 100755 index 0000000..3e17148 --- /dev/null +++ b/typescript/container/taler-config.sh @@ -0,0 +1,6 @@ +#!/bin/bash + +set -eu + +tsc /config.ts +node /config.js -- cgit v1.2.3