Skip to content

Commit 9a1c61c

Browse files
committed
cmd/coordinator: stop using gitlock, use go modules
Also, along for the ride: * update from jessie to stretch * update from Go 1.10 to Go 1.12 * move to multi-stage Dockerfile, including drawterm, reducing image size * remove the static linking which was resulting in build warnings * clean up Makefile Updates golang/go#26872 Updates golang/go#27719 Change-Id: Ic4dc9b8539fb8662c9621c113fa94b70bc7de061 Reviewed-on: https://go-review.googlesource.com/c/build/+/175985 Reviewed-by: Dmitri Shuralyov <[email protected]>
1 parent 4b4e29b commit 9a1c61c

File tree

5 files changed

+91
-279
lines changed

5 files changed

+91
-279
lines changed

cmd/coordinator/.gitignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
11
buildongce/client-*.dat
22
buildongce/token.dat
33
coordinator
4-
ca-certificates.crt

cmd/coordinator/Dockerfile

Lines changed: 76 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,68 @@
11
# Copyright 2017 The Go Authors. All rights reserved.
22
# Use of this source code is governed by a BSD-style
33
# license that can be found in the LICENSE file.
4-
FROM debian:jessie
4+
5+
FROM golang:1.12 AS build
56
LABEL maintainer "[email protected]"
67

7-
# openssh client is for the gomote ssh proxy client.
8-
# telnet is for the gomote ssh proxy to windows. (no ssh server there)
9-
# git-core, make, gcc, libc6-dev, and libx11-dev are to build 0intro/conterm,
10-
# used to connect to plan9 instances.
11-
RUN apt-get update && apt-get install -y \
12-
--no-install-recommends \
13-
ca-certificates \
14-
openssh-client \
15-
telnet \
16-
git-core make gcc libc6-dev libx11-dev \
17-
&& rm -rf /var/lib/apt/lists/*
8+
ENV GO111MODULE=on
9+
ENV GOPROXY=https://proxy.golang.org
10+
11+
RUN mkdir /gocache
12+
ENV GOCACHE /gocache
13+
14+
COPY go.mod /go/src/golang.org/x/build/go.mod
15+
COPY go.sum /go/src/golang.org/x/build/go.sum
16+
17+
WORKDIR /go/src/golang.org/x/build
18+
19+
# Optimization for iterative docker build speed, not necessary for correctness:
20+
# TODO: write a tool to make writing Go module-friendly Dockerfiles easier.
21+
RUN go install \
22+
cloud.google.com/go/compute/metadata \
23+
cloud.google.com/go/datastore \
24+
cloud.google.com/go/errorreporting \
25+
cloud.google.com/go/monitoring/apiv3 \
26+
cloud.google.com/go/storage \
27+
github.com/gliderlabs/ssh \
28+
github.com/golang/protobuf/ptypes \
29+
github.com/kr/pty \
30+
go4.org/syncutil \
31+
golang.org/x/crypto/acme/autocert \
32+
golang.org/x/crypto/ssh \
33+
golang.org/x/oauth2 \
34+
golang.org/x/oauth2/google \
35+
golang.org/x/perf/storage \
36+
golang.org/x/time/rate \
37+
google.golang.org/api/compute/v1 \
38+
google.golang.org/api/container/v1 \
39+
google.golang.org/api/googleapi \
40+
google.golang.org/genproto/googleapis/api/metric \
41+
google.golang.org/genproto/googleapis/monitoring/v3 \
42+
gopkg.in/inf.v0 \
43+
grpc.go4.org \
44+
&& true
45+
46+
# Makefile passes a string with --build-arg version
47+
# This becomes part of the cache key for all subsequent instructions,
48+
# so it must not be placed above the "go install" commands above.
49+
ARG version=unknown
50+
51+
# TODO: ideally we'd first copy all of x/build here EXCEPT
52+
# cmd/coordinator, then build x/build/..., and *then* COPY in the
53+
# cmd/coordinator files and then build the final binary. Currently we
54+
# do too much building of x/build/foo stuff when just modifying
55+
# cmd/coordinator/*.go files.
56+
57+
COPY . /go/src/golang.org/x/build/
58+
59+
RUN go install -ldflags "-X 'main.Version=$version'" golang.org/x/build/cmd/coordinator
60+
61+
62+
FROM debian:stretch AS build_drawterm
63+
64+
RUN apt-get update && apt-get install -y --no-install-recommends \
65+
git-core ca-certificates make gcc libc6-dev libx11-dev
1866

1967
# drawterm connects to plan9 instances like:
2068
# echo glenda123 | ./drawterm -a <addr> -c <addr> -u glenda -k user=glenda
@@ -25,5 +73,20 @@ RUN git clone https://github.com/0intro/conterm /tmp/conterm && \
2573
CONF=unix make && mv /tmp/conterm/drawterm /usr/local/bin && \
2674
rm -rf /tmp/conterm
2775

28-
COPY coordinator /
76+
77+
FROM debian:stretch
78+
79+
# openssh client is for the gomote ssh proxy client.
80+
# telnet is for the gomote ssh proxy to windows. (no ssh server there)
81+
RUN apt-get update && apt-get install -y \
82+
--no-install-recommends \
83+
ca-certificates \
84+
openssh-client \
85+
telnet \
86+
&& rm -rf /var/lib/apt/lists/*
87+
88+
89+
COPY --from=build /go/bin/coordinator /
90+
COPY --from=build_drawterm /usr/local/bin/drawterm /usr/local/bin/
91+
2992
ENTRYPOINT ["/coordinator"]

cmd/coordinator/Dockerfile.0

Lines changed: 0 additions & 237 deletions
This file was deleted.

0 commit comments

Comments
 (0)