Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -19,5 +19,8 @@ wasm-client.wasm
# Mobile build output
build/

# Reproducible build output
reproducible-builds/

# Misc
*.DS_Store
14 changes: 14 additions & 0 deletions Dockerfile-wasm
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#Get golang 1.17.3-buster as a base image
FROM golang:1.17.3-buster@sha256:ee3a388a872237ddb600de3ab9512e73df0043f8878f0f355baeb5b723ef16ec as builder

#Define the working directory in the container
WORKDIR /app

#Copy all files from root into the container
COPY . ./

#Use go mod tidy to handle dependencies
RUN go mod tidy

#Run the make task
RUN make wasm
19 changes: 18 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ build:
wasm:
# The appengine build tag is needed because of the jessevdk/go-flags library
# that has some OS specific terminal code that doesn't compile to WASM.
cd cmd/wasm-client; GOOS=js GOARCH=wasm go build -trimpath -ldflags="$(LDFLAGS)" -tags="$(RPC_TAGS)" -v -o wasm-client.wasm .
cd cmd/wasm-client; CGO_ENABLED=0 GOOS=js GOARCH=wasm go build -trimpath -ldflags="$(LDFLAGS)" -tags="$(RPC_TAGS)" -v -o wasm-client.wasm .
$(CP) cmd/wasm-client/wasm-client.wasm example/wasm-client.wasm

apple:
Expand All @@ -91,6 +91,23 @@ android:

mobile: ios android

repro-wasm:
#Build the repro-wasm image
docker build -f Dockerfile-wasm -t repro-wasm-image --no-cache .

#Run the repro-wasm-image in a new container called repro-wasm
docker run --name repro-wasm repro-wasm-image

#Copy the compiled WASM file to the host machine
mkdir -p reproducible-builds
docker cp repro-wasm:/app/cmd/wasm-client/wasm-client.wasm ./reproducible-builds/

#Remove the repro-wasm container
docker rm repro-wasm

#Remove the repro-wasm-image
docker image rm repro-wasm-image

# =======
# TESTING
# =======
Expand Down