diff --git a/Dockerfile.alpine-rust b/Dockerfile.alpine similarity index 90% rename from Dockerfile.alpine-rust rename to Dockerfile.alpine index 9965053a1..ca95e42c4 100644 --- a/Dockerfile.alpine-rust +++ b/Dockerfile.alpine @@ -1,12 +1,13 @@ -# this comes from standard alpine nightly file -# https://github.com/rust-lang/docker-rust-nightly/blob/master/alpine3.12/Dockerfile -# with some changes to support our toolchain, etc -FROM alpine:3.12 +# we build with go and rust +FROM golang:1.14-alpine3.12 ENV RUSTUP_HOME=/usr/local/rustup \ CARGO_HOME=/usr/local/cargo \ PATH=/usr/local/cargo/bin:$PATH +# this comes from standard alpine nightly file +# https://github.com/rust-lang/docker-rust-nightly/blob/master/alpine3.12/Dockerfile +# with some changes to support our toolchain, etc RUN set -eux; \ apk add --no-cache \ ca-certificates \ @@ -21,6 +22,11 @@ RUN chmod -R a+w $RUSTUP_HOME $CARGO_HOME # /usr/lib/gcc/x86_64-alpine-linux-musl/9.3.0/../../../../x86_64-alpine-linux-musl/bin/ld: cannot find crti.o: No such file or directory ENV LIBRARY_PATH=/usr/local/rustup/toolchains/nightly-2020-06-08-x86_64-unknown-linux-musl/lib/rustlib/x86_64-unknown-linux-musl/lib:$LIBRARY_PATH +# prepare go cache dirs +RUN mkdir -p /.cache/go-build +RUN chmod -R 777 /.cache + + # PRE-FETCH MANY DEPS WORKDIR /scratch COPY Cargo.toml /scratch/ diff --git a/Dockerfile.alpine-go b/Dockerfile.alpine-go deleted file mode 100644 index 7008c109e..000000000 --- a/Dockerfile.alpine-go +++ /dev/null @@ -1,7 +0,0 @@ -FROM golang:1.14-alpine3.12 - -RUN set -eux; \ - apk add --no-cache build-base; - -RUN mkdir -p /.cache/go-build -RUN chmod -R 777 /.cache diff --git a/Makefile b/Makefile index 0837307c4..3f9b3b7e1 100644 --- a/Makefile +++ b/Makefile @@ -1,6 +1,6 @@ .PHONY: all build build-rust build-go test docker-image docker-image-centos7 docker-image-cross -DOCKER_TAG := 0.8.1 +DOCKER_TAG := 0.8.2 USER_ID := $(shell id -u) USER_GROUP = $(shell id -g) @@ -59,8 +59,7 @@ docker-image-cross: docker build . -t cosmwasm/go-ext-builder:$(DOCKER_TAG)-cross -f ./Dockerfile.cross docker-image-alpine: - docker build . -t cosmwasm/go-ext-builder:$(DOCKER_TAG)-alpine -f ./Dockerfile.alpine-rust - docker build . -t cosmwasm/go-ext-tester:$(DOCKER_TAG)-alpine -f ./Dockerfile.alpine-go + docker build . -t cosmwasm/go-ext-builder:$(DOCKER_TAG)-alpine -f ./Dockerfile.alpine docker-images: docker-image-centos7 docker-image-cross docker-image-alpine @@ -68,7 +67,6 @@ docker-publish: docker-images docker push cosmwasm/go-ext-builder:$(DOCKER_TAG)-cross docker push cosmwasm/go-ext-builder:$(DOCKER_TAG)-centos7 docker push cosmwasm/go-ext-builder:$(DOCKER_TAG)-alpine - docker push cosmwasm/go-ext-tester:$(DOCKER_TAG)-alpine # and use them to compile release builds release: @@ -82,11 +80,9 @@ test-alpine: rm -rf target/release/examples docker run --rm -u $(USER_ID):$(USER_GROUP) -v $(shell pwd):/code cosmwasm/go-ext-builder:$(DOCKER_TAG)-alpine # try running go tests using this lib with muslc - docker run --rm -u $(USER_ID):$(USER_GROUP) -v $(shell pwd):/code -w /code cosmwasm/go-ext-tester:$(DOCKER_TAG)-alpine go build -tags muslc . - docker run --rm -u $(USER_ID):$(USER_GROUP) -v $(shell pwd):/code -w /code cosmwasm/go-ext-tester:$(DOCKER_TAG)-alpine go test -tags muslc ./api ./types + docker run --rm -u $(USER_ID):$(USER_GROUP) -v $(shell pwd):/code -w /code cosmwasm/go-ext-builder:$(DOCKER_TAG)-alpine go build -tags muslc . + docker run --rm -u $(USER_ID):$(USER_GROUP) -v $(shell pwd):/code -w /code cosmwasm/go-ext-builder:$(DOCKER_TAG)-alpine go test -tags muslc ./api ./types # build a go binary - docker run --rm -u $(USER_ID):$(USER_GROUP) -v $(shell pwd):/code -w /code cosmwasm/go-ext-tester:$(DOCKER_TAG)-alpine go build -tags muslc -o muslc.exe ./cmd - # run this binary in a simple alpine image - docker run --rm -it -v $(shell pwd):/code -w /code alpine:3.12 ./muslc.exe ./api/testdata/hackatom.wasm + docker run --rm -u $(USER_ID):$(USER_GROUP) -v $(shell pwd):/code -w /code cosmwasm/go-ext-builder:$(DOCKER_TAG)-alpine go build -tags muslc -o muslc.exe ./cmd # run static binary locally (not dlls) ./muslc.exe ./api/testdata/hackatom.wasm diff --git a/lib.go b/lib.go index 134abaca0..19e7a6554 100644 --- a/lib.go +++ b/lib.go @@ -181,12 +181,12 @@ func (w *Wasmer) Query( // the given data. // // MigrateMsg has some data on how to perform the migration. -func (w *Wasmer) Migrate(code CodeID, env types.Env, migrateMsg []byte, store *KVStore, goapi GoAPI, querier *Querier, gasMeter *api.GasMeter, gasLimit uint64) (*types.Result, uint64, error) { +func (w *Wasmer) Migrate(code CodeID, env types.Env, migrateMsg []byte, store KVStore, goapi GoAPI, querier Querier, gasMeter api.GasMeter, gasLimit uint64) (*types.Result, uint64, error) { paramBin, err := json.Marshal(env) if err != nil { return nil, 0, err } - data, gasUsed, err := api.Migrate(w.cache, code, paramBin, migrateMsg, gasMeter, store, &goapi, querier, gasLimit) + data, gasUsed, err := api.Migrate(w.cache, code, paramBin, migrateMsg, &gasMeter, &store, &goapi, &querier, gasLimit) if err != nil { return nil, gasUsed, err }