-
Notifications
You must be signed in to change notification settings - Fork 2
/
Dockerfile
54 lines (37 loc) · 1.42 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
# Simple usage with a mounted data directory:
# > docker build -t maticnetwork/heimdall:<tag> .
# > docker run -it -p 26657:26657 -p 26656:26656 -v ~/.heimdalld:/root/.heimdalld maticnetwork/heimdall:<tag> heimdalld init
# Start from a Debian image with the latest version of Go installed
# and a workspace (GOPATH) configured at /go.
FROM golang:latest as builder
ARG VERSION
# update available packages
RUN apt-get update -y && \
apt-get upgrade -y && \
apt install build-essential git -y && \
cd /root && \
git clone --depth=1 -b $VERSION -c advice.detachedHead=false https://github.com/maticnetwork/heimdall.git
# change work directory
WORKDIR /root/heimdall
# GOBIN required for go install
ENV GOBIN $GOPATH/bin
# run build
RUN make build
# Pull all binaries into a second stage deploy alpine container
FROM ubuntu:latest
RUN apt-get update -y \
&& apt-get install -y curl \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* \
&& curl -s -o /genesis.json https://raw.githubusercontent.com/maticnetwork/launch/master/mainnet-v1/without-sentry/heimdall/config/genesis.json
# Copy required binarires to new container
COPY --from=builder /root/heimdall/build/* /usr/local/bin/
COPY docker-entrypoint.sh /entrypoint.sh
ENV DATADIR=/root/.heimdalld
# add volumes
VOLUME ["$DATADIR"]
# expose ports
EXPOSE 1317 26656 26657
ENTRYPOINT ["/entrypoint.sh"]
# Run the binary.
CMD ["heimdalld","start"]