1
1

Added initial Clams build support.

This commit is contained in:
Derek Smith 2023-01-15 15:57:47 -05:00
parent bd129ed073
commit d91ba02e7f
Signed by: farscapian
GPG Key ID: 8F1CD799CCA516CC
2 changed files with 57 additions and 0 deletions

View File

@ -0,0 +1,29 @@
FROM node:latest
RUN apt-get update && apt-get install tzdata -y
ENV TZ="America/New_York"
#RUN npm install -g npm@9.3.0
# Clone the repository
RUN git clone https://github.com/clams-tech/browser-app.git /usr/src/clams
WORKDIR /usr/src/clams
# checkout specific tag
RUN git -c advice.detachedHead=false checkout tags/1.2.0
# couldn't do a yarn build without updating this.
# RUN npx -y update-browserslist-db@latest
# install dependencies
RUN yarn
EXPOSE 4173
RUN mkdir /output
VOLUME /output
RUN yarn build
ENTRYPOINT [ "cp", "-a", "/usr/src/clams/.svelte-kit/output/.", "/output/" ]

View File

@ -0,0 +1,28 @@
#!/bin/bash
# The purpose of this script is to use a Docker container to get and build the Clams
# server-side pieces and output them to a specified directory. These files are then
# ready build to be served by a TLS-enabled reverse proxy. It goes
# Client Browser -> wss (WebSocket over TLS) -> ProxyServer -> TCP to btcpayserver:9735
set -ex
cd "$(dirname "$0")"
export CLAMS_OUTPUT_DIR="$REMOTE_HOME/clams"
ssh "$PRIMARY_WWW_FQDN" sudo rm -rf "$CLAMS_OUTPUT_DIR"
ssh "$PRIMARY_WWW_FQDN" mkdir -p "$CLAMS_OUTPUT_DIR"
if docker ps | grep -q clams; then
docker kill clams
fi
if docker ps -a | grep -q clams; then
docker system prune -f
fi
docker build -t clams:latest .
docker run -it --name clams -v "$CLAMS_OUTPUT_DIR":/output clams:latest
ssh "$PRIMARY_WWW_FQDN" sudo chown -R ubuntu:ubuntu "$CLAMS_OUTPUT_DIR"