playground: enable gVisor in production
The sandbox code checks for GO_VERSION to be set to 1.14+. Setting it
correctly in the final stage of the Dockerfile will enable gVisor in
production.
Tested by using "//play:gvisor" in a unique production snippet.
Changes nacl testing path to unset GO_VERSION environment variable,
which will trigger the non-gvisor codepath.
Updates golang/go#25224
Change-Id: Iaf688fffdb68fcc3db2c6803327f24bbf0f98268
Reviewed-on: https://go-review.googlesource.com/c/playground/+/227643
Reviewed-by: Andrew Bonventre <andybons@golang.org>
Reviewed-by: Carlos Amedee <carlos@golang.org>
diff --git a/Dockerfile b/Dockerfile
index 97d9a28..c3a5c01 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -22,6 +22,7 @@
ENV PATH /usr/local/go/bin:$GOPATH/bin:$PATH
ENV GOROOT_BOOTSTRAP /usr/local/gobootstrap
ENV GO_BOOTSTRAP_VERSION go1.13.9
+ARG GO_VERSION
ENV GO_VERSION ${GO_VERSION}
# Fake time
@@ -93,6 +94,8 @@
COPY --from=nacl /tmp/sel_ldr_x86_64 /usr/local/bin
COPY --from=temp_pre_go14 /usr/local/go1.14 /usr/local/go1.14
+ARG GO_VERSION
+ENV GO_VERSION ${GO_VERSION}
ENV GOPATH /go
ENV PATH /usr/local/go/bin:$GOPATH/bin:$PATH
diff --git a/Makefile b/Makefile
index bac164f..56ff930 100644
--- a/Makefile
+++ b/Makefile
@@ -12,7 +12,7 @@
runlocal:
docker network create sandnet || true
docker kill play_dev || true
- docker run --name=play_dev --rm --network=sandnet -ti -p 127.0.0.1:8081:8080/tcp golang/playground
+ docker run --name=play_dev --rm --network=sandnet --env SANDBOX_BACKEND_URL="http://sandbox_dev.sandnet/run" -ti -p 127.0.0.1:8081:8080/tcp golang/playground
test_go:
# Run fast tests first: (and tests whether, say, things compile)
diff --git a/tests.go b/tests.go
index 0f3cda4..454b02a 100644
--- a/tests.go
+++ b/tests.go
@@ -29,6 +29,7 @@
func (s *server) testNacl() {
log.Printf("testing nacl mode")
+ os.Setenv("GO_VERSION", "")
s.runTests()
}