From bf403dbd4c1537fd05494f2a199464519e27fbc8 Mon Sep 17 00:00:00 2001 From: Matthieu Vachon Date: Fri, 5 May 2023 20:24:12 -0400 Subject: [PATCH] Fixed image and left some useful command I used to create the goreleaser-cross image --- .sfreleaser | 2 +- README.md | 19 +++++++++++++++++++ devel/docker/Dockerfile.goreleaser | 4 +--- devel/docker/push.sh | 2 +- 4 files changed, 22 insertions(+), 5 deletions(-) diff --git a/.sfreleaser b/.sfreleaser index cd81de0..8beaa53 100755 --- a/.sfreleaser +++ b/.sfreleaser @@ -9,5 +9,5 @@ release: # ./devel/docker/push.sh # # It will build the image locally, then you will be able to release. - goreleaser-docker-image: goreleaser-wasmedge:v1.20.3 + goreleaser-docker-image: goreleaser-cross-wasmedge:v1.20.3 upload-substreams-spkg: substreams.yaml \ No newline at end of file diff --git a/README.md b/README.md index ce43ccb..6f031b2 100644 --- a/README.md +++ b/README.md @@ -94,6 +94,25 @@ You can find a detailed example with documentation [here](./examples/wasm-query- Refer to the [general StreamingFast contribution guide](https://github.com/streamingfast/streamingfast/blob/master/CONTRIBUTING.md). +### WasmEdge + +Bumping `github.com/second-state/WasmEdge-go` to a newer version requires matching WasmEdge version. For example `github.com/second-state/WasmEdge-go@0.11.2` requires [WasmEdge 0.11.2](https://github.com/WasmEdge/WasmEdge/releases/tag/0.11.2). + +If a new version of [WasmEdge](https://github.com/WasmEdge/WasmEdge), it requires also modifying the [./devel/docker/Dockerfile.goreleaser](./devel/docker/Dockerfile.goreleaser) file so it pulls dependencies required for building using the correct version. Testing the build can be done using by first building the Docker image via `./devel/docker/push.sh` and then running: + +```bash +docker run --rm -it -v `pwd`:/work -w /work goreleaser-wasmedge:v1.20.3 release --snapshot --clean --skip-validate +``` + +Manual Golang compilation within the docker image can be done with: + +```bash +docker run --rm -it -v `pwd`:/work -w /work --entrypoint bash goreleaser-wasmedge:v1.20.3 +cd /work +# Adjust CC, CXX, C_INCLUDE_PATH, LIBRARY_PATH and GOOS/GOARCH according to .goreleaser.yaml file +CGO_ENABLED=1 CC=oa64-clang CXX=oa64-clang++ GOOS=darwin GOARCH=arm64 C_INCLUDE_PATH=/usr/local/osxcross/include/arm64 LIBRARY_PATH="/usr/local/osxcross/lib/arm64" go build -trimpath -mod=readonly -ldflags="-s -w" -o /work/substreams-sink-kv-cross-compiled ./cmd/substreams-sink-kv/ +``` + ## License [Apache 2.0](https://github.com/streamingfast/substreams/blob/develop/LICENSE/README.md). diff --git a/devel/docker/Dockerfile.goreleaser b/devel/docker/Dockerfile.goreleaser index 276e537..84ef5f2 100644 --- a/devel/docker/Dockerfile.goreleaser +++ b/devel/docker/Dockerfile.goreleaser @@ -8,7 +8,7 @@ RUN cd /root &&\ wget -O wasmedge.tar.gz https://github.com/WasmEdge/WasmEdge/releases/download/0.11.2/WasmEdge-0.11.2-ubuntu20.04_x86_64.tar.gz &&\ tar -xzvf wasmedge.tar.gz &&\ mkdir -p /usr/x86_64-linux-gnu/lib &&\ - cp -R WasmEdge-0.11.2-Linux/include /usr/x86_64-linux-gnu/include &&\ + cp -R WasmEdge-0.11.2-Linux/include/* /usr/x86_64-linux-gnu/include &&\ cp -R WasmEdge-0.11.2-Linux/lib/* /usr/x86_64-linux-gnu/lib &&\ rm -rf wasmedge-ubuntu-20.04-x86-64 @@ -32,8 +32,6 @@ RUN cd /root &&\ cp -Ra WasmEdge-0.11.2-Darwin/lib/libwasmedge.* /usr/local/osxcross/lib/amd64 &&\ rm -rf wasmedge-darwin-amd64 -COPY wasmedge/0.11.2-linux/lib /usr/x86_64-linux-gnu/lib -COPY wasmedge/0.11.2-linux/include/wasmedge /usr/x86_64-linux-gnu/include/wasmedge COPY --from=x86_64-linux-gnu /lib/x86_64-linux-gnu/libz.so.1* /usr/x86_64-linux-gnu/lib COPY --from=x86_64-linux-gnu /lib/x86_64-linux-gnu/libtinfo.so.6* /usr/x86_64-linux-gnu/lib diff --git a/devel/docker/push.sh b/devel/docker/push.sh index 8382b90..3e2909c 100755 --- a/devel/docker/push.sh +++ b/devel/docker/push.sh @@ -18,7 +18,7 @@ main() { docker_file="Dockerfile.goreleaser" fi - docker build -f "$docker_file" . -t goreleaser-wasmedge:v1.20.3 + docker build -f "$docker_file" . -t goreleaser-cross-wasmedge:v1.20.3 } usage_error() {