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
8 changes: 4 additions & 4 deletions build/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM node:13-alpine as ui-build
FROM node:17-alpine as ui-build
COPY web /tmp/web
WORKDIR /tmp/web
ARG APP_VERSION=1.0.0
Expand All @@ -7,7 +7,7 @@ ARG GITHUB_URL=https://github.com/x1unix/go-playground
RUN yarn install --silent && \
REACT_APP_VERSION=$APP_VERSION REACT_APP_GITHUB_URL=$GITHUB_URL REACT_APP_GTAG=$APP_GTAG yarn build

FROM golang:1.14-alpine as build
FROM golang:1.17-alpine as build
WORKDIR /tmp/playground
COPY cmd ./cmd
COPY pkg ./pkg
Expand All @@ -19,7 +19,7 @@ RUN echo "Building server with version $APP_VERSION" && \
GOOS=js GOARCH=wasm go build -o ./worker.wasm ./cmd/webworker && \
cp $(go env GOROOT)/misc/wasm/wasm_exec.js .

FROM golang:1.14-alpine as production
FROM golang:1.17-alpine as production
WORKDIR /opt/playground
ENV GOROOT /usr/local/go
ENV APP_CLEAN_INTERVAL=10m
Expand All @@ -32,4 +32,4 @@ COPY --from=build /tmp/playground/worker.wasm ./public
COPY --from=build /tmp/playground/wasm_exec.js ./public
EXPOSE 8000
ENTRYPOINT /opt/playground/server -f=/opt/playground/data/packages.json -addr=:8000 \
-clean-interval=${APP_CLEAN_INTERVAL} -debug=${APP_DEBUG} -playground-url=${APP_PLAYGROUND_URL}
-clean-interval=${APP_CLEAN_INTERVAL} -debug=${APP_DEBUG} -playground-url=${APP_PLAYGROUND_URL}
21 changes: 21 additions & 0 deletions web/src/services/go/fs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -94,4 +94,25 @@ export class FileSystemWrapper {
fsync(fd, callback) {
callback(null);
}

chmod(path, mode, callback) { callback(enosys()); }
chown(path, uid, gid, callback) { callback(enosys()); }
close(fd, callback) { callback(enosys()); }
fchmod(fd, mode, callback) { callback(enosys()); }
fchown(fd, uid, gid, callback) { callback(enosys()); }
fstat(fd, callback) { callback(enosys()); }
ftruncate(fd, length, callback) { callback(enosys()); }
lchown(path, uid, gid, callback) { callback(enosys()); }
link(path, link, callback) { callback(enosys()); }
lstat(path, callback) { callback(enosys()); }
mkdir(path, perm, callback) { callback(enosys()); }
readdir(path, callback) { callback(enosys()); }
readlink(path, callback) { callback(enosys()); }
rename(from, to, callback) { callback(enosys()); }
rmdir(path, callback) { callback(enosys()); }
stat(path, callback) { callback(enosys()); }
symlink(path, link, callback) { callback(enosys()); }
truncate(path, length, callback) { callback(enosys()); }
unlink(path, callback) { callback(enosys()); }
utimes(path, atime, mtime, callback) { callback(enosys()); }
}
5 changes: 1 addition & 4 deletions web/src/services/go/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,7 @@ export const bootstrapGo = (logger: ConsoleLogger) => {
// Wrap global object to make it accessible to Go's wasm bridge
const globalWrapper = new Proxy<Global>(window as any, {
has: (obj, prop) => prop in obj || prop in mocks,
get: (obj, prop) => {
console.log('go: get %s', prop);
return prop in obj ? obj[prop] : mocks[prop]
}
get: (obj, prop) => prop in obj ? obj[prop] : mocks[prop]
});
instance = new Go(globalWrapper);
};
2 changes: 1 addition & 1 deletion web/src/services/go/process.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ const CWD_STUB = '/';
/**
* Minimal NodeJS.Process implementation for wasm_exec.js
*
* Source: wasm_exec.js:87 in Go 1.14
* Source: wasm_exec.js:87 in Go 1.17
*/
const ProcessStub = {
getuid() { return PROCID_STUB; },
Expand Down
Loading