Skip to content

Commit

Permalink
Merge PR #3: Update chain versions
Browse files Browse the repository at this point in the history
* Update versions

* add new docker files & make cmds for building images

* add context dir to containers for new dockerfiles

* small dockerfile fix

Co-authored-by: jtieri <37750742+jtieri@users.noreply.github.com>
  • Loading branch information
jackzampolin and jtieri committed Oct 25, 2021
1 parent d936b1b commit 481bc33
Show file tree
Hide file tree
Showing 8 changed files with 118 additions and 12 deletions.
9 changes: 9 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
.github/
build/
chain-code/
clib/
docs/
data/
scripts/
testnets/
two-chains/
13 changes: 10 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
VERSION := $(shell echo $(shell git describe --tags) | sed 's/^v//')
COMMIT := $(shell git log -1 --format='%H')
SDKCOMMIT := $(shell go list -m -u -f '{{.Version}}' github.com/cosmos/cosmos-sdk)
GAIA_VERSION := v4.1.0
AKASH_VERSION := v0.10.2
WASMD_VERSION := v0.14.1
GAIA_VERSION := v5.0.4
AKASH_VERSION := v0.12.1
WASMD_VERSION := v0.16.0

GOPATH := $(shell go env GOPATH)
GOBIN := $(GOPATH)/bin
Expand Down Expand Up @@ -45,6 +45,11 @@ install: go.sum
@echo "installing rly binary..."
@go build -mod=readonly $(BUILD_FLAGS) -o $(GOBIN)/rly main.go

build-gaia-docker:
docker build -t cosmos/gaia:$(GAIA_VERSION) --build-arg VERSION=$(GAIA_VERSION) -f ./docker/gaiad/Dockerfile .

build-akash-docker:
docker build -t ovrclk/akash:$(AKASH_VERSION) --build-arg VERSION=$(AKASH_VERSION) -f ./docker/akash/Dockerfile .
###############################################################################
# Tests / CI
###############################################################################
Expand Down Expand Up @@ -102,6 +107,8 @@ get-wasmd:
build-wasmd:
@./scripts/build-wasmd

build-chains: build-akash build-gaia build-wasmd

delete-chains:
@echo "Removing the ./chain-code/ directory..."
@rm -rf ./chain-code
Expand Down
42 changes: 42 additions & 0 deletions docker/akash/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
FROM golang:1.16-alpine AS build-env
ARG VERSION

# Set up dependencies
ENV PACKAGES curl make git libc-dev bash gcc linux-headers eudev-dev

RUN apk add --no-cache $PACKAGES

WORKDIR /go/src/github.com/ovrclk

RUN git clone https://github.com/ovrclk/akash.git

WORKDIR /go/src/github.com/ovrclk/akash

RUN git checkout ${VERSION} && make install

FROM alpine:edge

RUN apk add --no-cache ca-certificates
WORKDIR /root

# Copy over binaries from the build-env
COPY --from=build-env /go/bin/akash /usr/bin/akash

#USER akash

WORKDIR /akash

COPY ./test/setup/akash-setup.sh .

COPY ./test/setup/valkeys ./setup/valkeys

USER root

RUN chmod -R 777 ./setup

#USER akash

EXPOSE 26657

ENTRYPOINT [ "./akash-setup.sh" ]
# NOTE: to run this image, docker run -d -p 26657:26657 ./akash-setup.sh {{chain_id}} {{genesis_account}} {{seeds}} {{priv_validator_key_path}}
40 changes: 40 additions & 0 deletions docker/gaiad/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
FROM golang:1.16-alpine AS build-env
ARG VERSION

ENV PACKAGES curl make git libc-dev bash gcc linux-headers eudev-dev

RUN apk add --no-cache $PACKAGES

WORKDIR /go/src/github.com/cosmos

RUN git clone https://github.com/cosmos/gaia.git

WORKDIR /go/src/github.com/cosmos/gaia

RUN git checkout ${VERSION} && make build-linux

FROM alpine:edge

RUN apk add --no-cache ca-certificates
WORKDIR /root

COPY --from=build-env /go/src/github.com/cosmos/gaia/build/gaiad /usr/bin/gaiad

#USER gaia

WORKDIR /gaia

COPY ./test/setup/gaia-setup.sh .

COPY ./test/setup/valkeys ./setup/valkeys

USER root

RUN chmod -R 777 ./setup

#USER gaia

EXPOSE 26657

ENTRYPOINT [ "./gaia-setup.sh" ]
# NOTE: to run this image, docker run -d -p 26657:26657 ./gaia-setup.sh {{chain_id}} {{genesis_account}} {{seeds}} {{priv_validator_key_path}}
2 changes: 1 addition & 1 deletion test/setup/Dockerfile.akashtest
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# https://hub.docker.com/r/ovrclk/akash/tags?page=1&ordering=last_updated
FROM ovrclk/akash:0.10.0
FROM ovrclk/akash:0.12.1

# Set up dependencies
ENV PACKAGES curl make git libc-dev bash gcc linux-headers eudev-dev python3
Expand Down
2 changes: 1 addition & 1 deletion test/setup/Dockerfile.gaiatest
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM tendermint/gaia:v4.2.1
FROM tendermint/gaia:v5.0.4

# Set up dependencies
ENV PACKAGES curl make git libc-dev bash gcc linux-headers eudev-dev python3
Expand Down
4 changes: 2 additions & 2 deletions test/test_chains.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ var (
// timeout_propose = "1000ms"
// 3 second relayer timeout works well with these block times
gaiaTestConfig = testChainConfig{
dockerfile: "./setup/Dockerfile.gaiatest",
dockerfile: "docker/gaiad/Dockerfile",
timeout: 3 * time.Second,
rpcPort: "26657",
accountPrefix: "cosmos",
Expand All @@ -40,7 +40,7 @@ var (
// 3 second relayer timeout works well with these block times
// This is built from contrib/Dockerfile.test from the akash repository:
akashTestConfig = testChainConfig{
dockerfile: "./setup/Dockerfile.akashtest",
dockerfile: "docker/akash/Dockerfile",
timeout: 3 * time.Second,
rpcPort: "26657",
accountPrefix: "akash",
Expand Down
18 changes: 13 additions & 5 deletions test/test_setup.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import (
"fmt"
"io/ioutil"
"os"
"path"
"strconv"
"strings"
"sync"
Expand Down Expand Up @@ -155,7 +156,14 @@ func spinUpTestContainer(t *testing.T, rchan chan<- *dockertest.Resource,
require.NoError(t, removeTestContainer(pool, containerName))

// create the proper docker image with port forwarding setup
resource, err = pool.BuildAndRunWithOptions(tc.t.dockerfile, dockerOpts)
d, err := os.Getwd()
require.NoError(t, err)

buildOpts := &dockertest.BuildOptions{
Dockerfile: tc.t.dockerfile,
ContextDir: path.Dir(d),
}
resource, err = pool.BuildAndRunWithBuildOptions(buildOpts, dockerOpts)
require.NoError(t, err)

c.Log(fmt.Sprintf("- [%s] SPUN UP IN CONTAINER %s from %s", c.ChainID,
Expand Down Expand Up @@ -211,11 +219,11 @@ func getLoggingChain(chns []*ry.Chain, rsr *dockertest.Resource) *ry.Chain {
}

func genTestPathAndSet(src, dst *ry.Chain, srcPort, dstPort string) (*ry.Path, error) {
path := ry.GenPath(src.ChainID, dst.ChainID, srcPort, dstPort, "UNORDERED", "ics20-1")
p := ry.GenPath(src.ChainID, dst.ChainID, srcPort, dstPort, "UNORDERED", "ics20-1")

src.PathEnd = path.Src
dst.PathEnd = path.Dst
return path, nil
src.PathEnd = p.Src
dst.PathEnd = p.Dst
return p, nil
}

func genPrivValKeyJSON(seedNumber int) {
Expand Down

0 comments on commit 481bc33

Please sign in to comment.