github.com/muhammedhassanm/blockchain@v0.0.0-20200120143007-697261defd4d/sawtooth-core-master/ci/sawtooth-publish-js-sdk (about) 1 # Copyright 2017 Intel Corporation 2 # 3 # Licensed under the Apache License, Version 2.0 (the "License"); 4 # you may not use this file except in compliance with the License. 5 # You may obtain a copy of the License at 6 # 7 # http://www.apache.org/licenses/LICENSE-2.0 8 # 9 # Unless required by applicable law or agreed to in writing, software 10 # distributed under the License is distributed on an "AS IS" BASIS, 11 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 # See the License for the specific language governing permissions and 13 # limitations under the License. 14 # ------------------------------------------------------------------------------ 15 16 # Description: 17 # Builds an environment to publish the Sawtooth JS SDK to NPM. Running it 18 # will update the version, install any NPM dependencies, and finally publish 19 # to the NPM registry. An NPM Auth Token must be set as an environment 20 # variable in the run command. 21 # 22 # Generating an npm auth token: 23 # $ npm adduser 24 # Username: hyperledger-sawtooth 25 # Password: 26 # Email: (this IS public) distributedledger@intel.com 27 # $ cat ~/.npmrc 28 # (copy the text after "authToken=" on the first line) 29 # 30 # Build: 31 # $ cd sawtooth-core 32 # $ docker build . -f ci/sawtooth-publish-js-sdk -t sawtooth-publish-js-sdk 33 # 34 # Run: 35 # $ cd sawtooth-core 36 # $ docker run -v $(pwd):/project/sawtooth-core -e AUTH_TOKEN={npm auth token} -e LATEST_STABLE={version to tag as latest stable} sawtooth-publish-js-sdk 37 38 FROM ubuntu:xenial 39 40 # Add additional xenial repos 41 RUN sh -c "echo deb http://archive.ubuntu.com/ubuntu xenial-backports main restricted universe multiverse >> /etc/apt/sources.list" && \ 42 sh -c "echo deb-src http://archive.ubuntu.com/ubuntu xenial-backports main restricted universe multiverse >> /etc/apt/sources.list" 43 44 # Create build directories 45 RUN mkdir -p /home/build/packages && mkdir -p /home/build/projects 46 ENV build_dir=/home/build/projects pkg_dir=/home/build/packages 47 48 # Install build deps 49 COPY ./bin/install_packaging_deps /home/build/install_packaging_deps 50 RUN apt-get update \ 51 && /home/build/install_packaging_deps \ 52 && apt-get clean \ 53 && rm -rf /var/lib/apt/lists/* 54 55 # Add sawtooth repo and dependencies 56 RUN echo "deb [arch=amd64] http://repo.sawtooth.me/ubuntu/1.0/stable xenial universe" >> /etc/apt/sources.list \ 57 && (apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 8AA7AF1F1091A5FD \ 58 || apt-key adv --keyserver hkp://p80.pool.sks-keyservers.net:80 --recv-keys 8AA7AF1F1091A5FD) \ 59 && apt-get update \ 60 && curl -sL https://deb.nodesource.com/setup_6.x | sudo -E bash - \ 61 && apt-get install -y -q \ 62 nodejs \ 63 python3-grpcio-tools=1.1.3-1 \ 64 python3-grpcio=1.1.3-1 \ 65 && apt-get clean \ 66 && rm -rf /var/lib/apt/lists/* 67 68 WORKDIR /project/sawtooth-core 69 70 # Publish JS SDK 71 CMD cd /project/sawtooth-core/sdk/javascript \ 72 && echo "//registry.npmjs.org/:_authToken=$AUTH_TOKEN" >> ~/.npmrc \ 73 && npm install --unsafe-perm \ 74 && npm publish --unsafe-perm \ 75 && npm dist-tags add sawtooth-sdk@$LATEST_STABLE latest