Skip to content

Commit e06994e

Browse files
committed
cmd/gopherbot: stop using gitlock, use go modules
Updates golang/go#26872 Change-Id: If64b03c03f29ccff2ffcf255d94a2c736806af89 Reviewed-on: https://go-review.googlesource.com/c/build/+/176602 Reviewed-by: Dmitri Shuralyov <[email protected]>
1 parent 626f5d4 commit e06994e

File tree

2 files changed

+35
-106
lines changed

2 files changed

+35
-106
lines changed

cmd/gopherbot/Dockerfile

+35-102
Original file line numberDiff line numberDiff line change
@@ -1,122 +1,55 @@
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 golang:1.11 AS build
5-
LABEL maintainer "[email protected]"
6-
7-
ENV CGO_ENABLED=0
8-
9-
# BEGIN deps (run `make update-deps` to update)
10-
11-
# Repo cloud.google.com/go at cc28e31 (2018-11-07)
12-
ENV REV=cc28e317d9ccd190960a456486e63767532be6ba
13-
RUN go get -d cloud.google.com/go/compute/metadata &&\
14-
(cd /go/src/cloud.google.com/go && (git cat-file -t $REV 2>/dev/null || git fetch -q origin $REV) && git reset --hard $REV)
15-
16-
# Repo github.com/golang/protobuf at 75dceb1 (2018-11-05)
17-
ENV REV=75dceb112b174be156fa9952e66d3e99945572b4
18-
RUN go get -d github.com/golang/protobuf/proto `#and 5 other pkgs` &&\
19-
(cd /go/src/github.com/golang/protobuf && (git cat-file -t $REV 2>/dev/null || git fetch -q origin $REV) && git reset --hard $REV)
20-
21-
# Repo github.com/google/go-github at 01a88ae (2018-10-30)
22-
ENV REV=01a88aee87606a81629924290413387b3ca30b00
23-
RUN go get -d github.com/google/go-github/github &&\
24-
(cd /go/src/github.com/google/go-github && (git cat-file -t $REV 2>/dev/null || git fetch -q origin $REV) && git reset --hard $REV)
254

26-
# Repo github.com/google/go-querystring at 44c6ddd (2018-09-16)
27-
ENV REV=44c6ddd0a2342c386950e880b658017258da92fc
28-
RUN go get -d github.com/google/go-querystring/query &&\
29-
(cd /go/src/github.com/google/go-querystring && (git cat-file -t $REV 2>/dev/null || git fetch -q origin $REV) && git reset --hard $REV)
30-
31-
# Repo github.com/gregjones/httpcache at 9cad4c3 (2018-03-06)
32-
ENV REV=9cad4c3443a7200dd6400aef47183728de563a38
33-
RUN go get -d github.com/gregjones/httpcache &&\
34-
(cd /go/src/github.com/gregjones/httpcache && (git cat-file -t $REV 2>/dev/null || git fetch -q origin $REV) && git reset --hard $REV)
35-
36-
# Repo go4.org at 417644f (2018-08-09)
37-
ENV REV=417644f6feb5ed3a356ca5d6d8e3a3fac7dfd33f
38-
RUN go get -d go4.org/strutil `#and 2 other pkgs` &&\
39-
(cd /go/src/go4.org && (git cat-file -t $REV 2>/dev/null || git fetch -q origin $REV) && git reset --hard $REV)
40-
41-
# Repo golang.org/x/net at 1c5f79c (2018-11-07)
42-
ENV REV=1c5f79cfb1642860bbe00b6cfce66700c01e04f6
43-
RUN go get -d golang.org/x/net/context `#and 8 other pkgs` &&\
44-
(cd /go/src/golang.org/x/net && (git cat-file -t $REV 2>/dev/null || git fetch -q origin $REV) && git reset --hard $REV)
5+
FROM golang:1.12 AS build
6+
LABEL maintainer "[email protected]"
457

46-
# Repo golang.org/x/oauth2 at f42d051 (2018-11-06)
47-
ENV REV=f42d05182288abf10faef86d16c0d07b8d40ea2d
48-
RUN go get -d golang.org/x/oauth2 `#and 2 other pkgs` &&\
49-
(cd /go/src/golang.org/x/oauth2 && (git cat-file -t $REV 2>/dev/null || git fetch -q origin $REV) && git reset --hard $REV)
508

51-
# Repo golang.org/x/sync at 1d60e46 (2018-03-14)
52-
ENV REV=1d60e4601c6fd243af51cc01ddf169918a5407ca
53-
RUN go get -d golang.org/x/sync/errgroup &&\
54-
(cd /go/src/golang.org/x/sync && (git cat-file -t $REV 2>/dev/null || git fetch -q origin $REV) && git reset --hard $REV)
9+
ENV GO111MODULE=on
10+
ENV GOPROXY=https://proxy.golang.org
5511

56-
# Repo golang.org/x/text at 6f44c5a (2018-10-30)
57-
ENV REV=6f44c5a2ea40ee3593d98cdcc905cc1fdaa660e2
58-
RUN go get -d golang.org/x/text/secure/bidirule `#and 4 other pkgs` &&\
59-
(cd /go/src/golang.org/x/text && (git cat-file -t $REV 2>/dev/null || git fetch -q origin $REV) && git reset --hard $REV)
12+
RUN mkdir /gocache
13+
ENV GOCACHE /gocache
6014

61-
# Repo golang.org/x/time at fbb02b2 (2018-04-12)
62-
ENV REV=fbb02b2291d28baffd63558aa44b4b56f178d650
63-
RUN go get -d golang.org/x/time/rate &&\
64-
(cd /go/src/golang.org/x/time && (git cat-file -t $REV 2>/dev/null || git fetch -q origin $REV) && git reset --hard $REV)
15+
COPY go.mod /go/src/golang.org/x/build/go.mod
16+
COPY go.sum /go/src/golang.org/x/build/go.sum
6517

66-
# Repo grpc.go4.org at 11d0a25 (2017-06-09)
67-
ENV REV=11d0a25b491971beb5a4625ea7856a3c4afaafa5
68-
RUN go get -d grpc.go4.org `#and 11 other pkgs` &&\
69-
(cd /go/src/grpc.go4.org && (git cat-file -t $REV 2>/dev/null || git fetch -q origin $REV) && git reset --hard $REV)
18+
WORKDIR /go/src/golang.org/x/build
7019

71-
# Optimization to speed up iterative development, not necessary for correctness:
72-
RUN go install cloud.google.com/go/compute/metadata \
73-
github.com/golang/protobuf/proto \
74-
github.com/golang/protobuf/ptypes \
75-
github.com/golang/protobuf/ptypes/any \
76-
github.com/golang/protobuf/ptypes/duration \
77-
github.com/golang/protobuf/ptypes/timestamp \
78-
github.com/google/go-github/github \
79-
github.com/google/go-querystring/query \
80-
github.com/gregjones/httpcache \
81-
go4.org/strutil \
82-
go4.org/types \
83-
golang.org/x/net/context \
84-
golang.org/x/net/context/ctxhttp \
85-
golang.org/x/net/http/httpguts \
86-
golang.org/x/net/http2 \
87-
golang.org/x/net/http2/hpack \
88-
golang.org/x/net/idna \
89-
golang.org/x/net/internal/timeseries \
90-
golang.org/x/net/trace \
91-
golang.org/x/oauth2 \
92-
golang.org/x/oauth2/internal \
93-
golang.org/x/sync/errgroup \
94-
golang.org/x/text/secure/bidirule \
95-
golang.org/x/text/transform \
96-
golang.org/x/text/unicode/bidi \
97-
golang.org/x/text/unicode/norm \
98-
golang.org/x/time/rate \
99-
grpc.go4.org \
100-
grpc.go4.org/codes \
101-
grpc.go4.org/credentials \
102-
grpc.go4.org/grpclog \
103-
grpc.go4.org/internal \
104-
grpc.go4.org/metadata \
105-
grpc.go4.org/naming \
106-
grpc.go4.org/peer \
107-
grpc.go4.org/stats \
108-
grpc.go4.org/tap \
109-
grpc.go4.org/transport
110-
# END deps
20+
# Optimization for iterative docker build speed, not necessary for correctness:
21+
# TODO: write a tool to make writing Go module-friendly Dockerfiles easier.
22+
RUN go install cloud.google.com/go/compute/metadata
23+
RUN go install github.com/google/go-github/github
24+
RUN go install go4.org/strutil
25+
RUN go install grpc.go4.org
26+
COPY gerrit /go/src/golang.org/x/build/gerrit
27+
RUN go install golang.org/x/build/gerrit
28+
COPY maintner /go/src/golang.org/x/build/maintner
29+
COPY cmd/pubsubhelper /go/src/golang.org/x/build/cmd/pubsubhelper
30+
RUN go install golang.org/x/build/maintner/maintnerd/apipb
31+
RUN go install golang.org/x/build/maintner/godata
11132

11233
COPY . /go/src/golang.org/x/build/
11334

11435
RUN go install golang.org/x/build/cmd/gopherbot
11536

11637

117-
FROM scratch
38+
FROM debian:stretch
11839
LABEL maintainer "[email protected]"
11940

120-
COPY --from=build /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/
41+
# netbase and ca-certificates are needed for dialing TLS.
42+
# The rest are useful for debugging if somebody needs to exec into the container.
43+
RUN apt-get update && apt-get install -y \
44+
--no-install-recommends \
45+
netbase \
46+
ca-certificates \
47+
curl \
48+
strace \
49+
procps \
50+
lsof \
51+
psmisc \
52+
&& rm -rf /var/lib/apt/lists/*
53+
12154
COPY --from=build /go/bin/gopherbot /
12255
ENTRYPOINT ["/gopherbot"]

cmd/gopherbot/Makefile

-4
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,6 @@ VERSION ?= $(shell git rev-parse --short HEAD)
88
IMAGE_STAGING := gcr.io/go-dashboard-dev/gopherbot
99
IMAGE_PROD := gcr.io/symbolic-datum-552/gopherbot
1010

11-
update-deps:
12-
go install golang.org/x/build/cmd/gitlock
13-
gitlock --update=Dockerfile golang.org/x/build/cmd/gopherbot
14-
1511
docker-image: Dockerfile *.go
1612
docker build --force-rm -f Dockerfile --tag=$(IMAGE_PROD):$(VERSION) ../..
1713
docker tag $(IMAGE_PROD):$(VERSION) $(IMAGE_PROD):$(MUTABLE_VERSION)

0 commit comments

Comments
 (0)