build: added brotli compression for wasm bits

WHAT:
added brotli compression for wasm files and added copying of those files to static/wasm folder in Dockerfile

WHY:
those files are a part of web worker webpack bundle and I didn't find a way to compress them separately using webpack.
I'm open to any other ideas if they come up

Change-Id: I105cc1582e9816fd9b63052ba48358525c85a164
This commit is contained in:
VitaliiShpital 2020-12-15 21:10:56 +02:00 committed by Stefan Benten
parent f4bbd0f5df
commit 79a3a47805
2 changed files with 9 additions and 1 deletions

View File

@ -28,6 +28,8 @@ COPY --from=ui /app/marketing /app/marketing
COPY --from=ca-cert /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/ca-certificates.crt
COPY release/${TAG}/wasm/access.wasm /app/static/wasm/
COPY release/${TAG}/wasm/wasm_exec.js /app/static/wasm/
COPY release/${TAG}/wasm/access.wasm.br /app/static/wasm/
COPY release/${TAG}/wasm/wasm_exec.js.br /app/static/wasm/
COPY release/${TAG}/satellite_linux_${GOARCH:-amd64} /app/satellite
COPY release/${TAG}/inspector_linux_${GOARCH:-amd64} /app/inspector
COPY cmd/satellite/entrypoint /entrypoint

View File

@ -9,5 +9,11 @@ mkdir -p release/$TAG/wasm/
# Copy wasm javascript to match the go version
cp "$(go env GOROOT)/misc/wasm/wasm_exec.js" release/$TAG/wasm/
# Compress wasm javascript using brotli
brotli -k release/$TAG/wasm/wasm_exec.js
# Build wasm code
exec go build -o release/$TAG/wasm/access.wasm storj.io/storj/satellite/console/wasm
go build -o release/$TAG/wasm/access.wasm storj.io/storj/satellite/console/wasm
# Compress wasm code using brotli
brotli -k release/$TAG/wasm/access.wasm