commit fd73de5cab154e462405c9f850ab0ad65ae12251
parent f09ed4aedbc7ab30588ab3f91ef4db5b13960bca
Author: ms <ms@taler.net>
Date: Tue, 31 May 2022 10:28:26 +0200
Sandbox.
Installing taler-wallet-lib via the wallet-core
build system.
Diffstat:
6 files changed, 32 insertions(+), 26 deletions(-)
diff --git a/typescript/config.ts b/typescript/config.ts
@@ -0,0 +1,2 @@
+var h = require("@gnu-taler/taler-config-lib");
+h()
diff --git a/typescript/container/Dockerfile b/typescript/container/Dockerfile
@@ -7,40 +7,45 @@ RUN apt-get install -y autoconf autopoint libtool texinfo \
libqrencode-dev zip jq nodejs npm openjdk-17-jre nginx procps curl
RUN pip3 install qrcode click requests jinja2 poetry babel
+# NOTE: taler-local is a _copy_ of the official
+# deployment/bin/taler-local, needed due to problems
+# referencing files outside of the Dockerfile's directory.
+COPY taler-local .
+
# Use taler-local to build from sources for now.
# This step will be optional, offering to install
# from Debian packages.
-
-# NOTE: taler-local is a _copy_ of the official deployment/bin/taler-local,
-# needed due to problems into referencing files outside of the Dockerfile's
-# directory.
-COPY taler-local .
-
RUN python3 /taler-local bootstrap --without-repos wallet-core
-RUN python3 /taler-local build
-
-# To debug. Will be removed.
-RUN echo "root:taler" | chpasswd
-# No need to manually login.
+RUN python3 /taler-local build
+# Setup the PNPM/TypeScript/Node environment.
+RUN npm install -g pnpm
+RUN pnpm config set global-bin-dir /usr/local/bin
+RUN pnpm install -g typescript
+RUN pnpm install --save-dev @types/node
+
+# Disable logins:
RUN systemctl mask console-getty
-# RUN systemctl mask systemd-logind
+RUN systemctl mask systemd-logind
+# This unit file will start along the boot process.
+# It'll create the database, and finally call the config
+# interpreter.
COPY prepare.service /etc/systemd/system
RUN chmod 664 /etc/systemd/system/prepare.service
+RUN systemctl enable prepare
+
+# Install 'taler-config-lib'.
+RUN git clone git://git.taler.net/wallet-core
+RUN cd /wallet-core && ./bootstrap && ./configure && make config-lib
-# prepare.sh creates the database and finally
-# calls the configuration interpreter / generator: taler-config.js.
+# Can be moved up (next to its unit file); here to
+# avoid huge re-buildings. prepare.sh creates the
+# database and finally calls the configuration interpreter
+# / generator: taler-config.js.
COPY prepare.sh .
-COPY export_path.sh /root/.bashrc
-RUN chmod +x prepare.sh
-RUN systemctl enable prepare
-# taler-config interprets - at runtime - the
-# TypeScript code that describes the deployment.
+# Compiles the TypeScript file passed in by the user,
+# sets NODE_PATH, and finally triggers the configuration.
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/export_path.sh b/typescript/container/export_path.sh
@@ -1,3 +0,0 @@
-#!/bin/bash
-
-export PATH=$PATH:$HOME/.local/bin
diff --git a/typescript/container/prepare.service b/typescript/container/prepare.service
@@ -1,5 +1,6 @@
[Unit]
Description=PrepareDatabase
+After=postgresql.service
[Service]
ExecStart=/prepare.sh
diff --git a/typescript/container/prepare.sh b/typescript/container/prepare.sh
diff --git a/typescript/container/taler-config.sh b/typescript/container/taler-config.sh
@@ -3,4 +3,5 @@
set -eu
tsc /config.ts
+export NODE_PATH=$(pnpm root -g)
node /config.js