From d6e90c2dbdc999d84f31082e2011b81591658878 Mon Sep 17 00:00:00 2001 From: David Boreham Date: Mon, 12 Dec 2022 12:38:12 -0700 Subject: [PATCH 1/3] Add generic entrypoint --- container-build/cerc-builder-js/Dockerfile | 5 ++++- container-build/cerc-builder-js/entrypoint.sh | 2 ++ 2 files changed, 6 insertions(+), 1 deletion(-) create mode 100755 container-build/cerc-builder-js/entrypoint.sh diff --git a/container-build/cerc-builder-js/Dockerfile b/container-build/cerc-builder-js/Dockerfile index 1f020839..faea9b38 100644 --- a/container-build/cerc-builder-js/Dockerfile +++ b/container-build/cerc-builder-js/Dockerfile @@ -33,4 +33,7 @@ RUN \ # RUN su node -c "source /usr/local/share/nvm/nvm.sh && nvm install ${EXTRA_NODE_VERSION}" # [Optional] Uncomment if you want to install more global node modules -# RUN su node -c "npm install -g " \ No newline at end of file +# RUN su node -c "npm install -g " + +COPY entrypoint.sh entrypoint.sh +ENTRYPOINT ./entrypoint.sh diff --git a/container-build/cerc-builder-js/entrypoint.sh b/container-build/cerc-builder-js/entrypoint.sh new file mode 100755 index 00000000..311cb8cb --- /dev/null +++ b/container-build/cerc-builder-js/entrypoint.sh @@ -0,0 +1,2 @@ +#!/bin/sh +exec "$@" From faa6027772a60a303b1dabb012f5344586e76d25 Mon Sep 17 00:00:00 2001 From: David Boreham Date: Mon, 12 Dec 2022 12:42:07 -0700 Subject: [PATCH 2/3] Fix entrypoint --- container-build/cerc-builder-js/Dockerfile | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/container-build/cerc-builder-js/Dockerfile b/container-build/cerc-builder-js/Dockerfile index faea9b38..a6b9de51 100644 --- a/container-build/cerc-builder-js/Dockerfile +++ b/container-build/cerc-builder-js/Dockerfile @@ -36,4 +36,5 @@ RUN \ # RUN su node -c "npm install -g " COPY entrypoint.sh entrypoint.sh -ENTRYPOINT ./entrypoint.sh +ENTRYPOINT ["./entrypoint.sh"] +CMD node --version \ No newline at end of file From 46375082d6d14780d052631bbbd89150459763e7 Mon Sep 17 00:00:00 2001 From: David Boreham Date: Mon, 12 Dec 2022 14:40:11 -0700 Subject: [PATCH 3/3] Support building an npm package to gitea --- app/data/repository-list.txt | 3 ++- container-build/cerc-builder-js/Dockerfile | 8 +++++-- container-build/cerc-builder-js/README.md | 11 ++++++++++ .../cerc-builder-js/build-npm-package.sh | 22 +++++++++++++++++++ 4 files changed, 41 insertions(+), 3 deletions(-) create mode 100644 container-build/cerc-builder-js/README.md create mode 100755 container-build/cerc-builder-js/build-npm-package.sh diff --git a/app/data/repository-list.txt b/app/data/repository-list.txt index a57b00dc..a8c28e00 100644 --- a/app/data/repository-list.txt +++ b/app/data/repository-list.txt @@ -8,7 +8,8 @@ vulcanize/ipld-eth-db-validator vulcanize/ipld-eth-beacon-indexer vulcanize/ipld-eth-beacon-db cerc-io/laconicd -cerc-io/laconic-cns-cli +cerc-io/laconic-sdk +cerc-io/laconic-registry-cli cerc-io/mobymask-watcher cerc-io/watcher-ts vulcanize/assemblyscript diff --git a/container-build/cerc-builder-js/Dockerfile b/container-build/cerc-builder-js/Dockerfile index a6b9de51..e9511933 100644 --- a/container-build/cerc-builder-js/Dockerfile +++ b/container-build/cerc-builder-js/Dockerfile @@ -35,6 +35,10 @@ RUN \ # [Optional] Uncomment if you want to install more global node modules # RUN su node -c "npm install -g " -COPY entrypoint.sh entrypoint.sh +COPY build-npm-package.sh . + +COPY entrypoint.sh . ENTRYPOINT ["./entrypoint.sh"] -CMD node --version \ No newline at end of file +# Placeholder CMD : generally this will be overridden at run time like : +# docker run -it -v /home/builder/cerc/laconic-sdk:/workspace cerc/builder-js sh -c 'cd /workspace && yarn && yarn build' +CMD node --version diff --git a/container-build/cerc-builder-js/README.md b/container-build/cerc-builder-js/README.md new file mode 100644 index 00000000..aa644612 --- /dev/null +++ b/container-build/cerc-builder-js/README.md @@ -0,0 +1,11 @@ +## Building JS/TS Packages + +As a temporary measure while the necessary functionality is being added to Stack Orchestrator, +it is possible to build packages manually by invoking `docker run` , for example as follows: + +``` +docker run -it --add-host host.docker.internal:host-gateway \ + -v ${HOME}/cerc/laconic-sdk:/workspace cerc/builder-js \ + sh -c 'cd /workspace && NPM_AUTH_TOKEN=6613572a28ebebaee20ccd90064251fa8c2b94f6 \ + /build-npm-package.sh http://host.docker.internal:3000/api/packages/cerc-io/npm/ 1.2.3-test' +``` \ No newline at end of file diff --git a/container-build/cerc-builder-js/build-npm-package.sh b/container-build/cerc-builder-js/build-npm-package.sh new file mode 100755 index 00000000..cc2eeb26 --- /dev/null +++ b/container-build/cerc-builder-js/build-npm-package.sh @@ -0,0 +1,22 @@ +#!/bin/bash +# Usage: build-npm-package.sh +# Note: supply the registry auth token in NPM_AUTH_TOKEN +if [ -n "$CERC_ENABLE_SCRIPT_DEBUG" ]; then + set -x +fi +if [[ $# -ne 2 ]]; then + echo "Illegal number of parameters" >&2 + exit 1 +fi +if [[ -z "${NPM_AUTH_TOKEN}" ]]; then + echo "NPM_AUTH_TOKEN is not set" >&2 + exit 1 +fi +local_npm_registry_url=$1 +package_publish_version=$2 +npm config set @cerc-io:registry ${local_npm_registry_url} +npm config set -- ${local_npm_registry_url}:_authToken ${NPM_AUTH_TOKEN} +echo "Build and publish version ${package_publish_version}" +yarn install +yarn build +yarn publish --non-interactive --new-version ${package_publish_version} --no-git-tag-version