forked from cosmos/interchain-security
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile.gaia
83 lines (62 loc) · 2.5 KB
/
Dockerfile.gaia
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
# syntax=docker/dockerfile:1
# build latest tagged gaia
FROM golang:1.20-alpine AS gaia-builder
# WORKDIR is set to /go by default
ARG USE_GAIA_TAG
ENV GAIA_TAG=${USE_GAIA_TAG}
ENV PACKAGES curl make git libc-dev bash gcc linux-headers
RUN apk add --no-cache $PACKAGES
ENV CGO_ENABLED=0
ENV GOOS=linux
ENV GOFLAGS="-buildvcs=false"
# cache go modules - done before the files are copied to allow docker to better cache
COPY go.mod /go.mod
COPY go.sum /go.sum
RUN go mod download
# Copy host machine's working directory into the container under /interchain-security
ADD . /interchain-security
RUN git clone https://github.com/cosmos/gaia.git
WORKDIR /go/gaia
# fetch gaia from tag and build it
RUN if [ -n "${GAIA_TAG}" ]; \
then git checkout "${GAIA_TAG}"; \
# if GAIA_TAG is not set, build the latest tagged version
else \
git checkout $(git tag | sort -Vr | head -n1); \
fi
# Also replace sdk version in the go.mod if specified
RUN if [ -d "/interchain-security/cosmos-sdk" ]; then \
go mod edit -replace github.com/cosmos/cosmos-sdk=/interchain-security/cosmos-sdk && \
echo "local sdk version used in gaia build"; \
fi
RUN go mod tidy
# Print the version of the sdk used in the build
RUN go list -m github.com/cosmos/cosmos-sdk
RUN make build
FROM golang:1.20-alpine AS is-builder
ENV PACKAGES curl make git libc-dev bash gcc linux-headers
RUN apk add --no-cache $PACKAGES
ENV CGO_ENABLED=0
ENV GOOS=linux
ENV GOFLAGS="-buildvcs=false"
# Copy in the repo under test
ADD . /interchain-security
WORKDIR /interchain-security
# Install interchain security binary
RUN make install
# Get Hermes build
FROM ghcr.io/informalsystems/hermes:1.4.1 AS hermes-builder
FROM --platform=linux/amd64 fedora:36
RUN dnf update -y
RUN dnf install -y which iproute iputils procps-ng vim-minimal tmux net-tools htop jq
USER root
COPY --from=hermes-builder /usr/bin/hermes /usr/local/bin/
# swap interchain-security-pd binary with gaia binary but keep the name
COPY --from=gaia-builder /go/gaia/build/gaiad /usr/local/bin/interchain-security-pd
COPY --from=is-builder /go/bin/interchain-security-cd /usr/local/bin/interchain-security-cd
COPY --from=is-builder /go/bin/interchain-security-cdd /usr/local/bin/interchain-security-cdd
COPY --from=is-builder /go/bin/interchain-security-sd /usr/local/bin/interchain-security-sd
# Copy in the shell scripts that run the testnet
ADD ./tests/e2e/testnet-scripts /testnet-scripts
# Copy in the hermes config
ADD ./tests/e2e/testnet-scripts/hermes-config.toml /root/.hermes/config.toml