Add docker configuration for faucet

This commit is contained in:
Simon Warta 2020-01-29 15:23:58 +01:00
parent c666f30fd2
commit 8c3c777869
3 changed files with 67 additions and 0 deletions

View File

@ -5,6 +5,7 @@ workflows:
jobs:
- build
- lint
- faucet_docker
jobs:
build:
@ -53,3 +54,18 @@ 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

23
faucet.Dockerfile Normal file
View File

@ -0,0 +1,23 @@
# 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
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/cosm-faucet"]
CMD [""]

View File

@ -74,6 +74,34 @@ the same mnemonic is used. Accessing the distributor accounts will be possible
as soon as there is
[multi account support](https://github.com/iov-one/ponferrada/milestone/3).
### Working with docker
- Build an artifact ()
```sh
docker build -t 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
```
- Run faucet locally
```sh
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 \
start cosmwasm "http://$DOCKER_HOST_IP:1317"
```
### Using the faucet
Now that the faucet has been started up, you can send credit requests to it.