-
Notifications
You must be signed in to change notification settings - Fork 108
/
Dockerfile-localnet
97 lines (72 loc) · 3.31 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
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
# syntax=ghcr.io/zeta-chain/docker-dockerfile:1.9-labs
# check=error=true
FROM ghcr.io/zeta-chain/golang:1.22.7-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 . .
ARG NODE_VERSION
ARG NODE_COMMIT
RUN --mount=type=cache,target="/root/.cache/go-build" \
NODE_VERSION=${NODE_VERSION} \
NODE_COMMIT=${NODE_COMMIT} \
make install install-zetae2e
FROM ghcr.io/zeta-chain/golang:1.22.7-bookworm AS cosmovisor-build
RUN go install cosmossdk.io/tools/cosmovisor/cmd/cosmovisor@v1.6.0
FROM ghcr.io/zeta-chain/golang:1.22.7-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 contrib/localnet/preparams /root/static-preparams
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 (from source). This old build is used as the genesis version in the upgrade tests.
# Use --target latest-runtime to skip.
# you must have already built the latest image (which the Makefile does)
FROM zetanode:latest AS old-build-source
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-source
COPY --from=cosmovisor-build /go/bin/cosmovisor /usr/local/bin
COPY --from=old-build-source /go/bin/zetacored /go/bin/zetaclientd /usr/local/bin/
COPY --from=latest-build /go/bin/zetaclientd-supervisor /usr/local/bin
# Optional old version build (from binary).
# Use --target latest-runtime to skip.
# you must have already built the latest image (which the Makefile does)
FROM zetanode:latest AS old-runtime
ARG OLD_VERSION
ARG BUILDARCH
RUN curl -Lo /usr/local/bin/zetacored ${OLD_VERSION}/zetacored-linux-${BUILDARCH} && \
chmod 755 /usr/local/bin/zetacored && \
curl -Lo /usr/local/bin/zetaclientd ${OLD_VERSION}/zetaclientd-linux-${BUILDARCH} && \
chmod 755 /usr/local/bin/zetaclientd