Skip to content

Commit

Permalink
create image and makefile steps to initialize chain state
Browse files Browse the repository at this point in the history
  • Loading branch information
p0mvn committed Apr 22, 2022
1 parent c175289 commit de89119
Show file tree
Hide file tree
Showing 3 changed files with 51 additions and 0 deletions.
7 changes: 7 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,10 @@ build-contract-tests-hooks:
mkdir -p $(BUILDDIR)
go build -mod=readonly $(BUILD_FLAGS) -o $(BUILDDIR)/ ./cmd/contract_tests

build-e2e-upgrade:
mkdir -p $(BUILDDIR)
go build -mod=readonly $(BUILD_FLAGS) -o $(BUILDDIR)/ ./tests/e2e/upgrade

go-mod-cache: go.sum
@echo "--> Download go modules to local cache"
@go mod download
Expand Down Expand Up @@ -241,6 +245,9 @@ benchmark:
docker-build-debug:
@docker build -t osmosis:debug --build-arg BASE_IMG_TAG=debug -f Dockerfile .

docker-build-e2e-init:
@docker build -t osmosis-e2e:debug --build-arg BASE_IMG_TAG=debug -f tests/e2e//upgrade/init-e2e.Dockerfile .

###############################################################################
### Linting ###
###############################################################################
Expand Down
23 changes: 23 additions & 0 deletions tests/e2e/upgrade/init-e2e.Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# syntax=docker/dockerfile:1

## Build Image
FROM golang:1.18-bullseye as build

WORKDIR /osmosis
COPY . /osmosis

# From https://github.com/CosmWasm/wasmd/blob/master/Dockerfile
# For more details see https://github.com/CosmWasm/wasmvm#builds-of-libwasmvm
ADD https://github.com/CosmWasm/wasmvm/releases/download/v1.0.0-beta7/libwasmvm_muslc.a /lib/libwasmvm_muslc.a
RUN sha256sum /lib/libwasmvm_muslc.a | grep d0152067a5609bfdfb3f0d5d6c0f2760f79d5f2cd7fd8513cafa9932d22eb350
RUN BUILD_TAGS=muslc make build-e2e-upgrade

## Deploy image
FROM ubuntu

COPY --from=build /osmosis/build/upgrade /bin/upgrade

ENV HOME /osmosis
WORKDIR $HOME

CMD [ "upgrade" ]
21 changes: 21 additions & 0 deletions tests/e2e/upgrade/main.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
package main

import (
"fmt"
"io/ioutil"

"github.com/osmosis-labs/osmosis/v7/tests/e2e/chain"
)

func main() {
tmpDir, err := ioutil.TempDir("", "osmosis-e2e-testnet-")
if err != nil {
panic(err)
}

chain, err := chain.Init(chain.ChainAID, tmpDir)
if err != nil {
panic(err)
}
fmt.Println(chain)
}

0 comments on commit de89119

Please sign in to comment.