From 609098affb79924fbaefbe986be072dddd2793af Mon Sep 17 00:00:00 2001 From: Simon Warta Date: Thu, 6 Feb 2020 10:41:08 +0100 Subject: [PATCH] Use faucet from NPM --- .circleci/config.yml | 16 ---------------- docs/faucet.Dockerfile | 15 +++++++++++++++ faucet.Dockerfile | 24 ------------------------ packages/faucet/README.md | 16 ++++++++++------ 4 files changed, 25 insertions(+), 46 deletions(-) create mode 100644 docs/faucet.Dockerfile delete mode 100644 faucet.Dockerfile diff --git a/.circleci/config.yml b/.circleci/config.yml index 19f0d010..3395a762 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -5,7 +5,6 @@ workflows: jobs: - build - lint - # - faucet_docker - test jobs: @@ -101,18 +100,3 @@ jobs: - ~/.cache/yarn - run: command: yarn lint - faucet_docker: - docker: - - image: circleci/node:10 - steps: - - checkout - - setup_remote_docker: - docker_layer_caching: true - - run: - name: Build docker image - command: docker build -t cosmwasm/faucet:manual --file faucet.Dockerfile . - - run: - name: Test docker image - command: | - docker run --read-only --rm cosmwasm/faucet:manual help - docker run --read-only --rm cosmwasm/faucet:manual version diff --git a/docs/faucet.Dockerfile b/docs/faucet.Dockerfile new file mode 100644 index 00000000..d863b964 --- /dev/null +++ b/docs/faucet.Dockerfile @@ -0,0 +1,15 @@ +# The only officially supported distribution channel of the faucet binary is @cosmwasm/faucet on npmjs.com +# This is an example file of how to wrap the faucet in a docker container. +# This file will be outdated very soon, but should work as a template for your custom docker setup. + +# Coose from https://hub.docker.com/_/node/ +FROM node:12.14.1-alpine + +RUN yarn global add @cosmwasm/faucet@0.0.3 + +# Check it exists +RUN /usr/local/bin/cosmwasm-faucet version + +EXPOSE 8000 +ENTRYPOINT ["/usr/local/bin/cosmwasm-faucet"] +CMD [""] diff --git a/faucet.Dockerfile b/faucet.Dockerfile deleted file mode 100644 index 558ede9d..00000000 --- a/faucet.Dockerfile +++ /dev/null @@ -1,24 +0,0 @@ -# Start the build environment -# https://hub.docker.com/_/node/ -FROM node:12.14-alpine AS build-env - -ADD package.json yarn.lock tsconfig.json lerna.json /build_repo_root/ -ADD packages/bcp /build_repo_root/packages/bcp -ADD packages/faucet /build_repo_root/packages/faucet -ADD packages/sdk /build_repo_root/packages/sdk - -WORKDIR /build_repo_root -RUN yarn install --frozen-lockfile -RUN yarn build - -# Start the runtime environment -FROM node:12.14-alpine -COPY --from=build-env /build_repo_root/package.json /run_repo_root/ -COPY --from=build-env /build_repo_root/yarn.lock /run_repo_root/ -COPY --from=build-env /build_repo_root/packages /run_repo_root/packages -WORKDIR /run_repo_root -RUN yarn install --frozen-lockfile --production - -EXPOSE 8000 -ENTRYPOINT ["/run_repo_root/packages/faucet/bin/cosmwasm-faucet"] -CMD [""] diff --git a/packages/faucet/README.md b/packages/faucet/README.md index dbac1235..5793bc26 100644 --- a/packages/faucet/README.md +++ b/packages/faucet/README.md @@ -76,29 +76,33 @@ as soon as there is ### Working with docker -- Build an artifact () +**Note:** The Dockerfile in this repo is for demonstration purposes only. If you chose to +deploy the faucet via docker, make sure to copy the Dockerfile and keep it up-to-date. + +- Build an artifact (from monorepo root) ```sh -docker build -t cosmwasm/faucet:manual --file faucet.Dockerfile . +cd docs +docker build -t local-cosmwasm-faucet:manual --file faucet.Dockerfile . ``` - Version and help ```sh -docker run --read-only --rm cosmwasm/faucet:manual version -docker run --read-only --rm cosmwasm/faucet:manual help +docker run --read-only --rm local-cosmwasm-faucet:manual version +docker run --read-only --rm local-cosmwasm-faucet:manual help ``` - Run faucet locally ```sh -DOCKER_HOST_IP=$(docker run --read-only --rm alpine ip route | awk 'NR==1 {print $3}') \ +DOCKER_HOST_IP=$(docker run --read-only --rm alpine ip route | awk 'NR==1 {print $3}'); \ FAUCET_CONCURRENCY=3 FAUCET_MNEMONIC="economy stock theory fatal elder harbor betray wasp final emotion task crumble siren bottom lizard educate guess current outdoor pair theory focus wife stone" \ docker run --read-only --rm \ -e FAUCET_MNEMONIC \ -e FAUCET_CONCURRENCY \ -p 8000:8000 \ - cosmwasm/faucet:manual \ + local-cosmwasm-faucet:manual \ start "http://$DOCKER_HOST_IP:1317" ```