Skip to content

Commit 15e9685

Browse files
committed
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 <[email protected]> Reviewed-by: Carlos Amedee <[email protected]>
1 parent 0bc4181 commit 15e9685

File tree

3 files changed

+5
-1
lines changed

3 files changed

+5
-1
lines changed

Dockerfile

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ ENV GOPATH /go
2222
ENV PATH /usr/local/go/bin:$GOPATH/bin:$PATH
2323
ENV GOROOT_BOOTSTRAP /usr/local/gobootstrap
2424
ENV GO_BOOTSTRAP_VERSION go1.13.9
25+
ARG GO_VERSION
2526
ENV GO_VERSION ${GO_VERSION}
2627

2728
# Fake time
@@ -93,6 +94,8 @@ COPY --from=build /usr/local/go /usr/local/go
9394
COPY --from=nacl /tmp/sel_ldr_x86_64 /usr/local/bin
9495
COPY --from=temp_pre_go14 /usr/local/go1.14 /usr/local/go1.14
9596

97+
ARG GO_VERSION
98+
ENV GO_VERSION ${GO_VERSION}
9699
ENV GOPATH /go
97100
ENV PATH /usr/local/go/bin:$GOPATH/bin:$PATH
98101

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ docker:
1212
runlocal:
1313
docker network create sandnet || true
1414
docker kill play_dev || true
15-
docker run --name=play_dev --rm --network=sandnet -ti -p 127.0.0.1:8081:8080/tcp golang/playground
15+
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
1616

1717
test_go:
1818
# Run fast tests first: (and tests whether, say, things compile)

tests.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ type compileTest struct {
2929

3030
func (s *server) testNacl() {
3131
log.Printf("testing nacl mode")
32+
os.Setenv("GO_VERSION", "")
3233
s.runTests()
3334
}
3435

0 commit comments

Comments
 (0)