Skip to content

Commit

Permalink
Fixed image and left some useful command I used to create the gorelea…
Browse files Browse the repository at this point in the history
…ser-cross image
  • Loading branch information
maoueh committed May 6, 2023
1 parent 2b218ee commit bf403db
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 5 deletions.
2 changes: 1 addition & 1 deletion .sfreleaser
Original file line number Diff line number Diff line change
Expand Up @@ -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
19 changes: 19 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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/[email protected]` 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).
Expand Down
4 changes: 1 addition & 3 deletions devel/docker/Dockerfile.goreleaser
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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

2 changes: 1 addition & 1 deletion devel/docker/push.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down

0 comments on commit bf403db

Please sign in to comment.