forked from celo-org/rosetta
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile
72 lines (58 loc) · 2.23 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
70
# USAGE INSTRUCTIONS:
#
# Docker Container Label: gcr.io/celo-testnet/rosetta
#
# Local Build For testing:
# docker build -t gcr.io/celo-testnet/rosetta:$USER .
#
# Run rosetta
# docker rm rosetta # Removes rosetta named container
# docker run --name rosetta gcr.io/celo-testnet/rosetta:$USER
# # or to create & delete
# docker run -rm gcr.io/celo-testnet/rosetta:$USER
#
# Build & Deploy:
# export COMMIT_SHA=$(git rev-parse HEAD)
# docker build --build-arg COMMIT_SHA=$COMMIT_SHA -t gcr.io/celo-testnet/rosetta:$COMMIT_SHA .
# docker push gcr.io/celo-testnet/rosetta:$COMMIT_SHA
#---------------------------------------------------------------------
# Stage 1: Build Rosetta
# Outputs: binary @ /rosetta/rosetta
#---------------------------------------------------------------------
FROM golang:1.14.12-alpine as builder
WORKDIR /rosetta
RUN apk add --no-cache make gcc musl-dev linux-headers git
# Downnload dependencies & cache them in docker layer
COPY go.mod .
COPY go.sum .
RUN go mod download
# Build project
# (this saves to redownload everything when go.mod/sum didn't change)
COPY . .
RUN go build --tags musl -o rosetta .
#---------------------------------------------------------------------
# Stage 2: Build Final container
# Integrates celo-blockchain & rosetta builds into a single container
# Outputs: rosetta & geth binaries on /usr/loca/bin
#---------------------------------------------------------------------
# adbdc7f8c27e50e77b407cb328193bd3ee823643 is mainet(1.0.0) + a few compatible commits that include tracing fix
# 63ece0c2482b596eac8ad9bc9d3af64e1af99a5a is mainnet(1.1.1) - unknown whether it has the tracing fixes
FROM us.gcr.io/celo-org/geth:63ece0c2482b596eac8ad9bc9d3af64e1af99a5a
ARG COMMIT_SHA
RUN apk add --no-cache ca-certificates
COPY --from=builder /rosetta/rosetta /usr/local/bin/
RUN echo $COMMIT_SHA > /version.txt
RUN mkdir /data
RUN mkdir /logs
RUN mkdir -p /var
EXPOSE 8080/tcp
EXPOSE 30503/tcp
EXPOSE 30503/udp
ENV ROSETTA_DATADIR="/data"
ENV ROSETTA_RPC_PORT="8080"
ENV ROSETTA_GETH_LOGFILE="/logs/celo.log"
ENV ROSETTA_GETH_IPCPATH="/var/geth.ipc"
ENV ROSETTA_GETH_BINARY="/usr/local/bin/geth"
ENV ROSETTA_GETH_GENESIS="/data/genesis.json"
ENTRYPOINT ["/usr/local/bin/rosetta"]
CMD ["run"]