1
1
# Copyright 2017 The Go Authors. All rights reserved.
2
2
# Use of this source code is governed by a BSD-style
3
3
# license that can be found in the LICENSE file.
4
- FROM debian:stretch as builder
4
+
5
+ FROM debian:stretch AS nacl
6
+
7
+ RUN apt-get update && apt-get install -y --no-install-recommends curl bzip2 ca-certificates
8
+
9
+ RUN curl -s https://storage.googleapis.com/nativeclient-mirror/nacl/nacl_sdk/trunk.544461/naclsdk_linux.tar.bz2 | tar -xj -C /tmp --strip-components=2 pepper_67/tools/sel_ldr_x86_64
10
+
11
+ FROM debian:stretch AS build
5
12
LABEL maintainer
"[email protected] "
6
13
7
14
ENV GOPATH /go
8
15
ENV PATH /usr/local/go/bin:$GOPATH/bin:$PATH
9
16
ENV GOROOT_BOOTSTRAP /usr/local/gobootstrap
10
- ENV CGO_ENABLED=0
11
- ENV GO_VERSION 1.12
12
- ENV BUILD_DEPS 'curl bzip2 git gcc patch libc6-dev ca-certificates'
17
+ ENV GO_VERSION 1.12.5
18
+ ENV BUILD_DEPS 'curl git gcc patch libc6-dev ca-certificates'
13
19
14
20
# Fake time
15
21
COPY enable-fake-time.patch /usr/local/playground/
@@ -18,8 +24,6 @@ COPY fake_fs.lst /usr/local/playground/
18
24
19
25
RUN apt-get update && apt-get install -y ${BUILD_DEPS} --no-install-recommends
20
26
21
- RUN curl -s https://storage.googleapis.com/nativeclient-mirror/nacl/nacl_sdk/trunk.544461/naclsdk_linux.tar.bz2 | tar -xj -C /tmp --strip-components=2 pepper_67/tools/sel_ldr_x86_64
22
-
23
27
# Get the Go binary.
24
28
RUN curl -sSL https://dl.google.com/go/go$GO_VERSION.linux-amd64.tar.gz -o /tmp/go.tar.gz
25
29
RUN curl -sSL https://dl.google.com/go/go$GO_VERSION.linux-amd64.tar.gz.sha256 -o /tmp/go.tar.gz.sha256
@@ -33,194 +37,28 @@ RUN cd /usr/local/go && go run misc/nacl/mkzip.go -p syscall /usr/local/playgrou
33
37
# Re-build the Go toolchain.
34
38
RUN cd /usr/local/go/src && GOOS=nacl GOARCH=amd64p32 ./make.bash --no-clean
35
39
36
- # BEGIN deps (run `make update-deps` to update)
37
-
38
- # Repo cloud.google.com/go at e2c125c (2019-02-22)
39
- ENV REV=e2c125ceac8b663cfcf4610477d4d67827377cb7
40
- RUN go get -d cloud.google.com/go/compute/metadata `#and 6 other pkgs` &&\
41
- (cd /go/src/cloud.google.com/go && (git cat-file -t $REV 2>/dev/null || git fetch -q origin $REV) && git reset --hard $REV)
42
-
43
- # Repo github.com/bradfitz/gomemcache at bc664df (2018-07-10)
44
- ENV REV=bc664df9673713a0ccf26e3b55a673ec7301088b
45
- RUN go get -d github.com/bradfitz/gomemcache/memcache &&\
46
- (cd /go/src/github.com/bradfitz/gomemcache && (git cat-file -t $REV 2>/dev/null || git fetch -q origin $REV) && git reset --hard $REV)
47
-
48
- # Repo github.com/golang/protobuf at c823c79 (2019-02-05)
49
- ENV REV=c823c79ea1570fb5ff454033735a8e68575d1d0f
50
- RUN go get -d github.com/golang/protobuf/proto `#and 8 other pkgs` &&\
51
- (cd /go/src/github.com/golang/protobuf && (git cat-file -t $REV 2>/dev/null || git fetch -q origin $REV) && git reset --hard $REV)
52
-
53
- # Repo github.com/googleapis/gax-go at ddfab93 (2019-01-11)
54
- ENV REV=ddfab93c3faef4935403ac75a7c11f0e731dc181
55
- RUN go get -d github.com/googleapis/gax-go/v2 &&\
56
- (cd /go/src/github.com/googleapis/gax-go && (git cat-file -t $REV 2>/dev/null || git fetch -q origin $REV) && git reset --hard $REV)
40
+ RUN mkdir /gocache
41
+ ENV GOCACHE /gocache
42
+ ENV GO111MODULE on
57
43
58
- # Repo github.com/hashicorp/golang-lru at 20f1fb7 (2018-08-29)
59
- ENV REV=20f1fb78b0740ba8c3cb143a61e86ba5c8669768
60
- RUN go get -d github.com/hashicorp/golang-lru/simplelru &&\
61
- (cd /go/src/github.com/hashicorp/golang-lru && (git cat-file -t $REV 2>/dev/null || git fetch -q origin $REV) && git reset --hard $REV)
62
-
63
- # Repo go.opencensus.io at beafb2a (2019-02-22)
64
- ENV REV=beafb2a85a579a4918ba259877a1625e9213a263
65
- RUN go get -d go.opencensus.io `#and 13 other pkgs` &&\
66
- (cd /go/src/go.opencensus.io && (git cat-file -t $REV 2>/dev/null || git fetch -q origin $REV) && git reset --hard $REV)
67
-
68
- # Repo golang.org/x/net at fe579d4 (2019-02-25)
69
- ENV REV=fe579d43d83210096a79b46dcca0e3721058393a
70
- RUN go get -d golang.org/x/net/context `#and 8 other pkgs` &&\
71
- (cd /go/src/golang.org/x/net && (git cat-file -t $REV 2>/dev/null || git fetch -q origin $REV) && git reset --hard $REV)
72
-
73
- # Repo golang.org/x/oauth2 at 9b3c759 (2019-02-20)
74
- ENV REV=9b3c75971fc92dd27c6436a37c05c831498658f1
75
- RUN go get -d golang.org/x/oauth2 `#and 5 other pkgs` &&\
76
- (cd /go/src/golang.org/x/oauth2 && (git cat-file -t $REV 2>/dev/null || git fetch -q origin $REV) && git reset --hard $REV)
77
-
78
- # Repo golang.org/x/sys at cc5685c (2019-02-25)
79
- ENV REV=cc5685c2db1239775905f3911f0067c0fa74762f
80
- RUN go get -d golang.org/x/sys/unix &&\
81
- (cd /go/src/golang.org/x/sys && (git cat-file -t $REV 2>/dev/null || git fetch -q origin $REV) && git reset --hard $REV)
82
-
83
- # Repo golang.org/x/text at d14c52b (2019-02-25)
84
- ENV REV=d14c52b222ee852cdba8b07206ca0c614b389876
85
- RUN go get -d golang.org/x/text/secure/bidirule `#and 4 other pkgs` &&\
86
- (cd /go/src/golang.org/x/text && (git cat-file -t $REV 2>/dev/null || git fetch -q origin $REV) && git reset --hard $REV)
87
-
88
- # Repo golang.org/x/tools at 2dc4ef2 (2019-02-25)
89
- ENV REV=2dc4ef2775b8122dd5afe2c18fd6f775e87f89e5
90
- RUN go get -d golang.org/x/tools/go/ast/astutil `#and 12 other pkgs` &&\
91
- (cd /go/src/golang.org/x/tools && (git cat-file -t $REV 2>/dev/null || git fetch -q origin $REV) && git reset --hard $REV)
92
-
93
- # Repo google.golang.org/api at 8a550ba (2019-02-24)
94
- ENV REV=8a550ba84cafabe9b2262c41303f31e5a4626318
95
- RUN go get -d google.golang.org/api/googleapi `#and 6 other pkgs` &&\
96
- (cd /go/src/google.golang.org/api && (git cat-file -t $REV 2>/dev/null || git fetch -q origin $REV) && git reset --hard $REV)
97
-
98
- # Repo google.golang.org/genproto at 082222b (2019-02-19)
99
- ENV REV=082222b4a5c572e33e82ee9162d1352c7cf38682
100
- RUN go get -d google.golang.org/genproto/googleapis/api/annotations `#and 5 other pkgs` &&\
101
- (cd /go/src/google.golang.org/genproto && (git cat-file -t $REV 2>/dev/null || git fetch -q origin $REV) && git reset --hard $REV)
102
-
103
- # Repo google.golang.org/grpc at 40cb561 (2019-02-25)
104
- ENV REV=40cb5618f475e7b9d61aa7920ae4b04ef9bbaf89
105
- RUN go get -d google.golang.org/grpc `#and 32 other pkgs` &&\
106
- (cd /go/src/google.golang.org/grpc && (git cat-file -t $REV 2>/dev/null || git fetch -q origin $REV) && git reset --hard $REV)
107
-
108
- # Optimization to speed up iterative development, not necessary for correctness:
109
- RUN go install cloud.google.com/go/compute/metadata \
110
- cloud.google.com/go/datastore \
111
- cloud.google.com/go/internal \
112
- cloud.google.com/go/internal/fields \
113
- cloud.google.com/go/internal/trace \
114
- cloud.google.com/go/internal/version \
115
- github.com/bradfitz/gomemcache/memcache \
116
- github.com/golang/protobuf/proto \
117
- github.com/golang/protobuf/protoc-gen-go/descriptor \
118
- github.com/golang/protobuf/ptypes \
119
- github.com/golang/protobuf/ptypes/any \
120
- github.com/golang/protobuf/ptypes/duration \
121
- github.com/golang/protobuf/ptypes/struct \
122
- github.com/golang/protobuf/ptypes/timestamp \
123
- github.com/golang/protobuf/ptypes/wrappers \
124
- github.com/googleapis/gax-go/v2 \
125
- github.com/hashicorp/golang-lru/simplelru \
126
- go.opencensus.io \
127
- go.opencensus.io/exemplar \
128
- go.opencensus.io/internal \
129
- go.opencensus.io/internal/tagencoding \
130
- go.opencensus.io/plugin/ocgrpc \
131
- go.opencensus.io/stats \
132
- go.opencensus.io/stats/internal \
133
- go.opencensus.io/stats/view \
134
- go.opencensus.io/tag \
135
- go.opencensus.io/trace \
136
- go.opencensus.io/trace/internal \
137
- go.opencensus.io/trace/propagation \
138
- go.opencensus.io/trace/tracestate \
139
- golang.org/x/net/context \
140
- golang.org/x/net/context/ctxhttp \
141
- golang.org/x/net/http/httpguts \
142
- golang.org/x/net/http2 \
143
- golang.org/x/net/http2/hpack \
144
- golang.org/x/net/idna \
145
- golang.org/x/net/internal/timeseries \
146
- golang.org/x/net/trace \
147
- golang.org/x/oauth2 \
148
- golang.org/x/oauth2/google \
149
- golang.org/x/oauth2/internal \
150
- golang.org/x/oauth2/jws \
151
- golang.org/x/oauth2/jwt \
152
- golang.org/x/sys/unix \
153
- golang.org/x/text/secure/bidirule \
154
- golang.org/x/text/transform \
155
- golang.org/x/text/unicode/bidi \
156
- golang.org/x/text/unicode/norm \
157
- golang.org/x/tools/go/ast/astutil \
158
- golang.org/x/tools/go/gcexportdata \
159
- golang.org/x/tools/go/internal/cgo \
160
- golang.org/x/tools/go/internal/gcimporter \
161
- golang.org/x/tools/go/internal/packagesdriver \
162
- golang.org/x/tools/go/packages \
163
- golang.org/x/tools/godoc/static \
164
- golang.org/x/tools/imports \
165
- golang.org/x/tools/internal/fastwalk \
166
- golang.org/x/tools/internal/gopathwalk \
167
- golang.org/x/tools/internal/module \
168
- golang.org/x/tools/internal/semver \
169
- google.golang.org/api/googleapi \
170
- google.golang.org/api/googleapi/internal/uritemplates \
171
- google.golang.org/api/internal \
172
- google.golang.org/api/iterator \
173
- google.golang.org/api/option \
174
- google.golang.org/api/transport/grpc \
175
- google.golang.org/genproto/googleapis/api/annotations \
176
- google.golang.org/genproto/googleapis/datastore/v1 \
177
- google.golang.org/genproto/googleapis/rpc/code \
178
- google.golang.org/genproto/googleapis/rpc/status \
179
- google.golang.org/genproto/googleapis/type/latlng \
180
- google.golang.org/grpc \
181
- google.golang.org/grpc/balancer \
182
- google.golang.org/grpc/balancer/base \
183
- google.golang.org/grpc/balancer/roundrobin \
184
- google.golang.org/grpc/binarylog/grpc_binarylog_v1 \
185
- google.golang.org/grpc/codes \
186
- google.golang.org/grpc/connectivity \
187
- google.golang.org/grpc/credentials \
188
- google.golang.org/grpc/credentials/internal \
189
- google.golang.org/grpc/credentials/oauth \
190
- google.golang.org/grpc/encoding \
191
- google.golang.org/grpc/encoding/proto \
192
- google.golang.org/grpc/grpclog \
193
- google.golang.org/grpc/internal \
194
- google.golang.org/grpc/internal/backoff \
195
- google.golang.org/grpc/internal/binarylog \
196
- google.golang.org/grpc/internal/channelz \
197
- google.golang.org/grpc/internal/envconfig \
198
- google.golang.org/grpc/internal/grpcrand \
199
- google.golang.org/grpc/internal/grpcsync \
200
- google.golang.org/grpc/internal/syscall \
201
- google.golang.org/grpc/internal/transport \
202
- google.golang.org/grpc/keepalive \
203
- google.golang.org/grpc/metadata \
204
- google.golang.org/grpc/naming \
205
- google.golang.org/grpc/peer \
206
- google.golang.org/grpc/resolver \
207
- google.golang.org/grpc/resolver/dns \
208
- google.golang.org/grpc/resolver/passthrough \
209
- google.golang.org/grpc/stats \
210
- google.golang.org/grpc/status \
211
- google.golang.org/grpc/tap
212
- # END deps
44
+ # Pre-build some packages to speed final install later.
45
+ RUN go install cloud.google.com/go/compute/metadata
46
+ RUN go install cloud.google.com/go/datastore
47
+ RUN go install github.com/bradfitz/gomemcache/memcache
48
+ RUN go install golang.org/x/tools/godoc/static
49
+ RUN go install golang.org/x/tools/imports
213
50
214
51
# Add and compile playground daemon
215
52
COPY . /go/src/playground/
216
- RUN go install playground
53
+ WORKDIR /go/src/playground
54
+ RUN go install
217
55
218
56
FROM debian:stretch
219
57
220
58
RUN apt-get update && apt-get install -y git ca-certificates --no-install-recommends
221
59
222
- COPY --from=builder /usr/local/go /usr/local/go
223
- COPY --from=builder /tmp/sel_ldr_x86_64 /usr/local/bin
60
+ COPY --from=build /usr/local/go /usr/local/go
61
+ COPY --from=nacl /tmp/sel_ldr_x86_64 /usr/local/bin
224
62
225
63
ENV GOPATH /go
226
64
ENV PATH /usr/local/go/bin:$GOPATH/bin:$PATH
@@ -247,13 +85,16 @@ RUN mkdir -p $GOPATH/src/code.google.com/p/go-tour && \
247
85
248
86
RUN mkdir /app
249
87
250
- COPY --from=builder /go/bin/playground /app
88
+ COPY --from=build /go/bin/playground /app
251
89
COPY edit.html /app
252
90
COPY static /app/static
253
91
WORKDIR /app
254
92
255
93
# Run tests
256
94
RUN /app/playground test
257
95
96
+ # Whether we allow third-party imports via proxy.golang.org:
97
+ ENV ALLOW_PLAY_MODULE_DOWNLOADS false
98
+
258
99
EXPOSE 8080
259
100
ENTRYPOINT ["/app/playground" ]
0 commit comments