I am building a Wasm application and to compile it I have a shell script. When I run it manually from terminal I have the following:
/app/Go/assets$ ./script.compile.wasm.sh
Wasm compiled
The content of the file is:
#!/bin/sh
GOOS=js GOARCH=wasm go build -o ./app.wasm ./wasm.go
echo "Wasm compiled"
The wasm file is properly compiled.
But when I run it from Docker I get:
Step 15/20 : RUN ./assets/compile.wasm.sh
---> Running in 38dd56259b0f
go: cannot find main module; see 'go help modules'
Wasm compiled
The compilation fails.
The Docker line looks like:
RUN ./assets/compile.wasm.sh