From 46e883ac8a47aba4a9c12560426cd460be2bc6c9 Mon Sep 17 00:00:00 2001 From: theborakompanioni Date: Thu, 31 Oct 2024 09:46:36 +0100 Subject: [PATCH] feat(dev): ability to skip release verification --- readme.md | 26 +++++++++++++++++++++++--- standalone/Dockerfile | 16 ++++++++++++---- ui-only/Dockerfile | 12 +++++++++--- 3 files changed, 44 insertions(+), 10 deletions(-) diff --git a/readme.md b/readme.md index b3a31f2..1a5b96f 100644 --- a/readme.md +++ b/readme.md @@ -15,20 +15,30 @@ docker pull ghcr.io/joinmarket-webui/jam-ui-only:latest ### Environment variables -The following environment variables control the configuration +The following environment variables control the configuration: - `JAM_JMWALLETD_HOST` (required; jmwalletd hostname) - `JAM_JMWALLETD_API_PORT` (required; jmwalletd api port) - `JAM_JMWALLETD_WEBSOCKET_PORT` (required; jmwalletd websocket port) - `JAM_JMOBWATCH_PORT` (required; ob-watcher port) ### Building Notes +Building a specific release: ```sh docker build --label "local" \ + --build-arg JAM_REPO_REF=v0.3.0 \ + --tag "joinmarket-webui/jam-ui-only" ./ui-only +``` + +Building from a specific branch (with disabled release verification): +```sh +docker build --label "local" \ + --build-arg VERIFY_RELEASE=false \ --build-arg JAM_REPO_REF=master \ --tag "joinmarket-webui/jam-ui-only" ./ui-only ``` #### Build args +- `VERIFY_RELEASE` (optional, defaults to `true`; enable or disable release verification) - `JAM_REPO` (ui git repo; defaults to `https://github.com/joinmarket-webui/jam`) - `JAM_REPO_REF` (ui git ref; defaults to `master`) @@ -74,7 +84,7 @@ docker pull ghcr.io/joinmarket-webui/jam-standalone:latest ``` ### Environment variables -The following environment variables control the configuration +The following environment variables control the configuration: - `APP_USER` (optional; username used for basic authentication) - `APP_PASSWORD` (optional, but required if `APP_USER` is provided; password used for basic authentication) - `ENSURE_WALLET` (optional, defaults to `false`; create and load the wallet in bitcoin core on startup) @@ -87,17 +97,27 @@ Variables starting with prefix `JM_` will be applied to `joinmarket.cfg` e.g.: - `JM_GAPLIMIT: 2000` will set the `gaplimit` config value to `2000` ### Building Notes +Building a specific release: ```sh docker build --label "local" \ + --build-arg JAM_REPO_REF=v0.3.0 \ + --build-arg JM_SERVER_REPO_REF=v0.9.11 \ + --tag "joinmarket-webui/jam-standalone" ./standalone +``` + +Building from a specific branch (with disabled release verification): +```sh +docker build --label "local" \ + --build-arg VERIFY_RELEASE=false \ --build-arg JAM_REPO_REF=master \ --build-arg JM_SERVER_REPO_REF=master \ --tag "joinmarket-webui/jam-standalone" ./standalone ``` #### Build args +- `VERIFY_RELEASE` (optional, defaults to `true`; enable or disable release verification) - `JAM_REPO` (ui git repo; defaults to `https://github.com/joinmarket-webui/jam`) - `JAM_REPO_REF` (ui git ref; defaults to `master`) ---- - `JM_SERVER_REPO` (server git repo; defaults to `https://github.com/JoinMarket-Org/joinmarket-clientserver`) - `JM_SERVER_REPO_REF` (server git ref; defaults to `master`) diff --git a/standalone/Dockerfile b/standalone/Dockerfile index e343c65..44c415a 100644 --- a/standalone/Dockerfile +++ b/standalone/Dockerfile @@ -8,6 +8,8 @@ ARG JAM_REPO_REF=master ARG JM_SERVER_REPO=https://github.com/JoinMarket-Org/joinmarket-clientserver ARG JM_SERVER_REPO_REF=master +ARG VERIFY_RELEASE=true + ARG NODE_IMAGE_VERSION=22.11.0 ARG NODE_IMAGE_HASH=f265794478aa0b1a23d85a492c8311ed795bc527c3fe7e43453b3c872dcd71a3 ARG NODE_IMAGE=node:${NODE_IMAGE_VERSION}-alpine@sha256:${NODE_IMAGE_HASH} @@ -17,6 +19,7 @@ ARG ALPINE_IMAGE=alpine:${ALPINE_IMAGE_VERSION}@sha256:${ALPINE_IMAGE_HASH} ARG DEBIAN_IMAGE_VERSION=bullseye-20240926-slim ARG DEBIAN_IMAGE_HASH=3f9e53602537cc817d96f0ebb131a39bdb16fa8b422137659a9a597e7e3853c1 ARG DEBIAN_IMAGE=debian:${DEBIAN_IMAGE_VERSION}@sha256:${DEBIAN_IMAGE_HASH} + ARG DINIT_VERSION=0.19.0 FROM ${NODE_IMAGE} AS node @@ -30,6 +33,7 @@ RUN apk add --no-cache --update git gnupg FROM builder-base AS ui-builder ARG JAM_REPO ARG JAM_REPO_REF +ARG VERIFY_RELEASE COPY --from=node /usr/lib /usr/lib COPY --from=node /usr/local/lib /usr/local/lib @@ -42,8 +46,10 @@ COPY pubkeys/ /pubkeys # checkout and build project RUN git clone "$JAM_REPO" . --depth=1 --branch "$JAM_REPO_REF" \ - && find /pubkeys -iname '*.asc' -exec gpg --import "{}" \; \ - && git verify-tag "$JAM_REPO_REF" \ + && (if [ "$VERIFY_RELEASE" != "false" ]; then \ + find /pubkeys -iname '*.asc' -exec gpg --import "{}" \; \ + && git verify-tag "$JAM_REPO_REF"; \ + fi) \ && npm install --no-fund --no-audit \ && npm run build # --- UI builder - end @@ -80,8 +86,10 @@ WORKDIR /usr/src/joinmarket-clientserver COPY pubkeys/ /pubkeys RUN git clone "$JM_SERVER_REPO" . --depth=1 --branch "$JM_SERVER_REPO_REF" \ - && find /pubkeys -iname '*.asc' -exec gpg --import "{}" \; \ - && git verify-tag "$JM_SERVER_REPO_REF" + && (if [ "$VERIFY_RELEASE" != "false" ]; then \ + find /pubkeys -iname '*.asc' -exec gpg --import "{}" \; \ + && git verify-tag "$JM_SERVER_REPO_REF"; \ + fi) # --- SERVER builder - end # --- RUNTIME builder diff --git a/ui-only/Dockerfile b/ui-only/Dockerfile index a806374..a23688b 100644 --- a/ui-only/Dockerfile +++ b/ui-only/Dockerfile @@ -5,6 +5,8 @@ ARG MAINTAINER='Jam https://github.com/joinmarket-webui' ARG JAM_REPO=https://github.com/joinmarket-webui/jam ARG JAM_REPO_REF=master +ARG VERIFY_RELEASE=true + ARG NODE_IMAGE_VERSION=22.11.0 ARG NODE_IMAGE_HASH=f265794478aa0b1a23d85a492c8311ed795bc527c3fe7e43453b3c872dcd71a3 ARG NODE_IMAGE=node:${NODE_IMAGE_VERSION}-alpine@sha256:${NODE_IMAGE_HASH} @@ -27,10 +29,11 @@ COPY --from=node /usr/local/bin /usr/local/bin # install build dependencies RUN apk add --no-cache --update git gnupg -# --- +# --- UI builder FROM builder-base AS builder ARG JAM_REPO ARG JAM_REPO_REF +ARG VERIFY_RELEASE WORKDIR /usr/src/app @@ -38,10 +41,13 @@ COPY pubkeys/ /pubkeys # checkout and build project RUN git clone "$JAM_REPO" . --depth=1 --branch "$JAM_REPO_REF" \ - && find /pubkeys -iname '*.asc' -exec gpg --import "{}" \; \ - && git verify-tag "$JAM_REPO_REF" \ + && (if [ "$VERIFY_RELEASE" != "false" ]; then \ + find /pubkeys -iname '*.asc' -exec gpg --import "{}" \; \ + && git verify-tag "$JAM_REPO_REF"; \ + fi) \ && npm install --no-fund --no-audit \ && npm run build +# --- UI builder - end # --- FROM ${NGINX_IMAGE} AS runtime