-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
23b7c7f
commit ae5f86c
Showing
5 changed files
with
70 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
{ | ||
// Use IntelliSense to learn about possible attributes. | ||
// Hover to view descriptions of existing attributes. | ||
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 | ||
"version": "0.2.0", | ||
"configurations": [] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
FROM golang:1.17-alpine AS build | ||
WORKDIR /go/conway | ||
COPY . . | ||
RUN cp $(go env GOROOT)/misc/wasm/wasm_exec.js ./html/wasm_exec.js | ||
RUN GOOS=js GOARCH=wasm go build -o ./html/main.wasm . | ||
|
||
FROM nginx:1.21-alpine | ||
COPY html/nginx /etc/nginx | ||
COPY --from=build /go/conway/html/index.html /go/conway/html/main.wasm /go/conway/html/wasm_exec.js var/www/code.sknk.ws/public/ | ||
RUN adduser -u 82 -D -S -G www-data www-data | ||
EXPOSE 80 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
<!DOCTYPE html> | ||
<script src="wasm_exec.js"></script> | ||
<script> | ||
// Polyfill | ||
if (!WebAssembly.instantiateStreaming) { | ||
WebAssembly.instantiateStreaming = async (resp, importObject) => { | ||
const source = await (await resp).arrayBuffer(); | ||
return await WebAssembly.instantiate(source, importObject); | ||
}; | ||
} | ||
|
||
const go = new Go(); | ||
WebAssembly.instantiateStreaming(fetch("main.wasm"), go.importObject).then(result => { | ||
go.run(result.instance); | ||
}); | ||
</script> |
Submodule nginx
added at
f1ee74
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters