Skip to content
This repository was archived by the owner on Apr 24, 2025. It is now read-only.

Commit 44fe076

Browse files
authored
Merge pull request #82 from tetratelabs/user-tinygo-dev-image
use tinygo/tinygo-dev image and add make target for building binaries with docker image
2 parents 5a6a7b0 + 0680885 commit 44fe076

File tree

3 files changed

+21
-8
lines changed

3 files changed

+21
-8
lines changed

.github/workflows/workflow.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ jobs:
3232
name: build examples
3333
runs-on: ubuntu-latest
3434
container:
35-
image: getenvoy/extension-tinygo-builder:wasi-dev
35+
image: tinygo/tinygo-dev:latest # TODO: use the tagged `tinygo/tinygo:0.xx.x` image after the next release
3636
steps:
3737
- name: checkout
3838
uses: actions/checkout@v2

Makefile

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,23 @@
22

33
ISTIO_VERSION ?= 1.7.2
44

5-
.PHONY: build.example build.examples lint test test.sdk test.e2e
5+
.PHONY: build.example build.example.docker build.examples build.examples.docker lint test test.sdk test.e2e
66

77
build.example:
88
tinygo build -o ./examples/${name}/main.go.wasm -scheduler=none -target=wasi -wasm-abi=generic ./examples/${name}/main.go
99

10+
build.example.docker:
11+
docker run -it -w /tmp/proxy-wasm-go -v $(shell pwd):/tmp/proxy-wasm-go tinygo/tinygo-dev:latest \
12+
tinygo build -o /tmp/proxy-wasm-go/examples/${name}/main.go.wasm -scheduler=none -target=wasi \
13+
-wasm-abi=generic /tmp/proxy-wasm-go/examples/${name}/main.go
14+
1015
build.examples:
1116
find ./examples -type f -name "main.go" | xargs -Ip tinygo build -o p.wasm -scheduler=none -target=wasi -wasm-abi=generic p
1217

18+
build.examples.docker:
19+
docker run -it -w /tmp/proxy-wasm-go -v $(shell pwd):/tmp/proxy-wasm-go tinygo/tinygo-dev:latest /bin/bash -c \
20+
'find /tmp/proxy-wasm-go/examples/ -type f -name "main.go" | xargs -Ip tinygo build -o p.wasm -scheduler=none -target=wasi -wasm-abi=generic p'
21+
1322
lint:
1423
golangci-lint run --build-tags proxytest
1524

README.md

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -35,18 +35,20 @@ func (ctx *metricHttpContext) OnHttpRequestHeaders(int, bool) types.Action {
3535

3636
### requirements
3737

38-
proxy-wasm-go-sdk depends on the latest TinyGo which supports WASI target([tinygo-org/tinygo#1373](https://github.com/tinygo-org/tinygo/pull/1373)).
39-
In order to install that, simply run (Ubuntu/Debian):
38+
proxy-wasm-go-sdk depends on TinyGo's latest [dev branch](https://github.com/tinygo-org/tinygo/tree/dev) which supports WASI target([tinygo-org/tinygo#1373](https://github.com/tinygo-org/tinygo/pull/1373))
39+
and has yet to be tagged.
40+
41+
In order to install that version of TinyGo, simply run (Ubuntu/Debian):
4042

4143
```shell
4244
# this corresponds to https://github.com/tinygo-org/tinygo/commit/f50ad3585d084b17f7754f4b3cb0d42661fee036
4345
wget https://19227-136505169-gh.circle-artifacts.com/0/tmp/tinygo_amd64.deb
4446
dpkg -i tinygo_amd64.deb
4547
```
4648

47-
Alternatively, you can use the pre-built docker container `getenvoy/extention-tingyo-builder:wasi-dev` for any platform.
49+
Alternatively, you can use the pre-built docker container `tinygo/tinygo-dev:latest` for any platform.
4850

49-
TinyGo's official release of WASI target will come soon, and after that you could
51+
TinyGo's official tagged release of WASI target will come soon, and after that you could
5052
just follow https://tinygo.org/getting-started/ to install the requirement on any platform. Stay tuned!
5153

5254

@@ -63,9 +65,11 @@ TinyGo's official release of WASI target will come soon, and after that you coul
6365
build:
6466

6567
```bash
66-
make build.examples # build all examples
68+
make build.examples # build all examples
69+
make build.examples.docker # in docker
6770

68-
make build.example name=helloworld # build a specific example
71+
make build.example name=helloworld # build a specific example
72+
make build.example.docker name=helloworld # in docker
6973
```
7074

7175
run:

0 commit comments

Comments
 (0)