forked from zeta-chain/node
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile-localnet
81 lines (59 loc) · 2.73 KB
/
Dockerfile-localnet
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
71
72
73
74
75
76
77
78
79
80
81
# syntax=docker/dockerfile:1.7-labs
FROM golang:1.20.14-bookworm AS base-build
ENV GOPATH /go
ENV GOOS=linux
ENV CGO_ENABLED=1
ENV GOCACHE=/root/.cache/go-build
RUN apt update && \
apt install -yq libusb-dev
WORKDIR /go/delivery/zeta-node
FROM base-build AS latest-build
COPY go.mod .
COPY go.sum .
RUN go mod download
COPY version.sh .
COPY --exclude=*.sh --exclude=*.md --exclude=*.yml . .
RUN --mount=type=cache,target="/root/.cache/go-build" make install
RUN --mount=type=cache,target="/root/.cache/go-build" make install-zetae2e
FROM golang:1.20.14-bookworm AS cosmovisor-build
RUN go install cosmossdk.io/tools/cosmovisor/cmd/[email protected]
FROM golang:1.20.14-bookworm AS base-runtime
RUN apt update && \
apt install -yq jq yq curl tmux python3 openssh-server iputils-ping iproute2 bind9-host && \
rm -rf /var/lib/apt/lists/*
RUN ssh-keygen -A && \
mkdir -p /var/run/sshd
RUN mkdir -p /root/.zetacored/cosmovisor/genesis/bin && \
ln -s /usr/local/bin/zetacored /root/.zetacored/cosmovisor/genesis/bin/zetacored && \
ln -s /root/.zetacored/cosmovisor/genesis /root/.zetacored/cosmovisor/current && \
mkdir -p /root/.zetaclientd/upgrades/genesis && \
ln -s /usr/local/bin/zetaclientd /root/.zetaclientd/upgrades/genesis/zetacored && \
ln -s /root/.zetaclientd/upgrades/genesis /root/.zetaclientd/upgrades/current
ENV PATH /root/.zetacored/cosmovisor/current/bin/:/root/.zetaclientd/upgrades/current/:${PATH}
COPY contrib/localnet/scripts /root
COPY contrib/localnet/ssh_config /etc/ssh/ssh_config.d/localnet.conf
COPY contrib/localnet/zetacored /root/zetacored
COPY cmd/zetae2e/config/localnet.yml /root/config.yml
RUN chmod 755 /root/*.sh && \
chmod 644 /etc/ssh/ssh_config.d/localnet.conf
WORKDIR /usr/local/bin
EXPOSE 22
FROM base-runtime AS latest-runtime
COPY --from=cosmovisor-build /go/bin/cosmovisor /usr/local/bin
COPY --from=latest-build /go/bin/zetacored /go/bin/zetaclientd /go/bin/zetaclientd-supervisor /go/bin/zetae2e /usr/local/bin
# optional old version build. This old build is used as the genesis version in the upgrade tests.
# use --target latest-runtime to skip
#
# TODO: just download binaries from github release now that we're using glibc
# we can't do this right now since we do not have a v16 release candidate
# https://github.com/zeta-chain/node/issues/2179
FROM base-build as old-build
ARG OLD_VERSION
RUN git clone https://github.com/zeta-chain/node.git
RUN cd node && git fetch
RUN cd node && git checkout ${OLD_VERSION}
RUN cd node && make install
FROM base-runtime AS old-runtime
COPY --from=cosmovisor-build /go/bin/cosmovisor /usr/local/bin
COPY --from=old-build /go/bin/zetacored /go/bin/zetaclientd /usr/local/bin
COPY --from=latest-build /go/bin/zetaclientd-supervisor /usr/local/bin