Skip to content

Commit

Permalink
Bundle faucet
Browse files Browse the repository at this point in the history
  • Loading branch information
webmaster128 committed Apr 12, 2022
1 parent b8db0b3 commit 0f138e8
Show file tree
Hide file tree
Showing 4 changed files with 34 additions and 7 deletions.
11 changes: 5 additions & 6 deletions packages/faucet/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -13,16 +13,15 @@ FROM node:14-alpine as build-env
ADD . /app
WORKDIR /app

RUN apk add --update --no-cache alpine-sdk linux-headers build-base gcc libusb-dev python3 py3-pip eudev-dev \
&& ln -sf python3 /usr/bin/python
# Do we really need to update those?
RUN pip3 install --no-cache --upgrade pip setuptools
RUN apk add --update --no-cache alpine-sdk linux-headers build-base gcc libusb-dev python3 py3-pip eudev-dev
RUN ln -sf python3 /usr/bin/python

RUN yarn install && yarn run build
RUN (cd packages/faucet && SKIP_BUILD=1 yarn pack-node)

FROM node:14-alpine
COPY --from=build-env /app /app
COPY --from=build-env /app/packages/faucet /app/packages/faucet
WORKDIR /app

EXPOSE 8000
ENTRYPOINT ["yarn", "node", "/app/packages/faucet/bin/cosmos-faucet"]
ENTRYPOINT ["/app/packages/faucet/bin/cosmos-faucet-dist"]
6 changes: 6 additions & 0 deletions packages/faucet/bin/cosmos-faucet-dist
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#!/usr/bin/env node
const path = require("path");

// attempt to call in main file....
const faucet = require(path.join(__dirname, "..", "dist", "node", "cli.js"));
faucet.main(process.argv.slice(2));
3 changes: 2 additions & 1 deletion packages/faucet/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,8 @@
"test": "yarn build-or-skip && yarn test-node",
"coverage": "nyc --reporter=text --reporter=lcov yarn test --quiet",
"start-dev": "FAUCET_ADDRESS_PREFIX=wasm FAUCET_CREDIT_AMOUNT_UCOSM=10000000 FAUCET_CREDIT_AMOUNT_USTAKE=100000 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\" ./bin/cosmos-faucet start \"http://localhost:26659\"",
"start-coralnet": "FAUCET_ADDRESS_PREFIX=coral FAUCET_TOKENS=\"ushell,ureef\" FAUCET_CREDIT_AMOUNT_USHELL=10000000 FAUCET_CREDIT_AMOUNT_UREEF=2000000 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\" ./bin/cosmos-faucet start \"https://lcd.coralnet.cosmwasm.com\""
"start-coralnet": "FAUCET_ADDRESS_PREFIX=coral FAUCET_TOKENS=\"ushell,ureef\" FAUCET_CREDIT_AMOUNT_USHELL=10000000 FAUCET_CREDIT_AMOUNT_UREEF=2000000 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\" ./bin/cosmos-faucet start \"https://lcd.coralnet.cosmwasm.com\"",
"pack-node": "yarn build-or-skip && webpack --mode production --config webpack.node.config.js"
},
"dependencies": {
"@cosmjs/crypto": "workspace:packages/crypto",
Expand Down
21 changes: 21 additions & 0 deletions packages/faucet/webpack.node.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
/* eslint-disable @typescript-eslint/naming-convention */
const path = require("path");

const target = "node";
const distdir = path.join(__dirname, "dist", target);

module.exports = [
{
target: target,
entry: "./build/cli.js",
output: {
path: distdir,
filename: "cli.js",
library: {
type: "commonjs",
},
},
plugins: [],
resolve: {},
},
];

0 comments on commit 0f138e8

Please sign in to comment.