-
Notifications
You must be signed in to change notification settings - Fork 356
/
Dockerfile
69 lines (56 loc) · 2.62 KB
/
Dockerfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
# Docker image for this file is hosted at
# us.gcr.io/celo-testnet/celocli:master
#
# How to test changes to this file
# docker build -f dockerfiles/cli/Dockerfile.cli -t gcr.io/celo-testnet/celocli:$USER . --build-arg celo_env=alfajores
# To run this image locally
# docker rm cli_container; docker run --name cli_container -p 8545:8545 gcr.io/celo-testnet/celocli:$USER -v /
# To run this image locally in ultralight mode
# docker rm cli_container; docker run --name cli_container -p 8545:8545 -it --entrypoint=/celo/start_geth.sh gcr.io/celo-testnet/celocli:$USER "/usr/local/bin/geth" "alfajores" "full"
# and connect to it with
# docker exec -t -i cli_container /bin/sh
#
# Run commands against it using
# docker exec -it cli_container celocli <sub-command>
# For example,
# docker exec -it cli_container celocli account:balance 0x456f41406B32c45D59E539e4BBA3D7898c3584dA
# docker exec -it cli_container celocli account:balance 0xa0Af2E71cECc248f4a7fD606F203467B500Dd53B
#
# To restart
# docker start -ai cli_container
#
# To kill
# docker kill cli_container
ARG geth_tag=master
ARG geth_project=celo-testnet
# Get geth and related files
FROM us.gcr.io/$geth_project/geth:$geth_tag as geth
ARG celo_env
RUN echo "Env is ${celo_env}" && apk add curl && mkdir /celo
ADD https://www.googleapis.com/storage/v1/b/genesis_blocks/o/${celo_env}?alt=media /celo/genesis.json
ADD https://www.googleapis.com/storage/v1/b/static_nodes/o/${celo_env}?alt=media /celo/static-nodes.json
# Build Celocli
FROM node:8-alpine as node
ARG celo_env
RUN echo "geth_tag is ${geth_tag}" && echo "Env is ${celo_env}"
# Required for celocli
RUN apk update && apk add python git make gcc g++
WORKDIR /celo-monorepo/
RUN npm install @celo/celocli
# Build the combined image
FROM node:8-alpine as final_image
ARG network_name="alfajores"
ARG network_id="44781"
# Without musl-dev, geth will fail with a confusing "No such file or directory" error.
# bash is required for start_geth.sh
RUN apk update && apk add musl-dev && apk add bash
WORKDIR /celo-monorepo/
RUN echo "Dir is ${PWD}" && echo "env is ${celo_env}" && mkdir /celo
COPY packages/cli/start_geth.sh /celo/start_geth.sh
COPY --from=geth /usr/local/bin/geth /usr/local/bin/geth
COPY --from=geth /celo/genesis.json /celo
COPY --from=geth /celo/static-nodes.json /celo
COPY --from=node /celo-monorepo/node_modules /celo-monorepo/node_modules
RUN chmod ugo+x /celo/start_geth.sh && ln -s /celo-monorepo/node_modules/.bin/celocli /usr/local/bin/celocli
EXPOSE 8545 8546 30303 30303/udp
ENTRYPOINT ["/celo/start_geth.sh", "/usr/local/bin/geth", "alfajores", "full", "44781", "/root/.celo", "/celo/genesis.json", "/celo/static-nodes.json"]