forked from golang/build
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
cmd/gopherbot: add Kubernetes config
Updates golang/go#18817 Change-Id: I8947eaf02d9b4ea49db00879bef8d1c6cb54184a Reviewed-on: https://go-review.googlesource.com/42251 Reviewed-by: Quentin Smith <[email protected]>
- Loading branch information
1 parent
37abedf
commit 2b6ab5e
Showing
6 changed files
with
128 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
gopherbot | ||
ca-certificates.crt |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
# Copyright 2017 The Go Authors. All rights reserved. | ||
# Use of this source code is governed by a BSD-style | ||
# license that can be found in the LICENSE file. | ||
FROM scratch | ||
LABEL maintainer "[email protected]" | ||
|
||
COPY ca-certificates.crt /etc/ssl/certs/ | ||
COPY gopherbot / | ||
ENTRYPOINT ["/gopherbot"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
# Copyright 2017 The Go Authors. All rights reserved. | ||
# Use of this source code is governed by a BSD-style | ||
# license that can be found in the LICENSE file. | ||
FROM golang:1.8 | ||
LABEL maintainer "[email protected]" | ||
|
||
RUN go get -d cloud.google.com/go/compute/metadata && \ | ||
cd /go/src/cloud.google.com/go/compute/metadata && \ | ||
git reset --hard cd0da878c66091060d2e7403abd62192b3e387e0 | ||
|
||
RUN go get -d golang.org/x/oauth2 && \ | ||
cd /go/src/golang.org/x/oauth2 && \ | ||
git reset --hard 314dd2c0bf3ebd592ec0d20847d27e79d0dbe8dd | ||
|
||
RUN go get -d github.com/golang/protobuf/proto && \ | ||
cd /go/src/github.com/golang/protobuf/proto && \ | ||
git reset --hard 18c9bb3261723cd5401db4d0c9fbc5c3b6c70fe8 | ||
|
||
RUN go get -d github.com/google/go-github/github && \ | ||
cd /go/src/github.com/google/go-github/github && \ | ||
git reset --hard e8d46665e050742f457a58088b1e6b794b2ae966 | ||
|
||
RUN go get -d github.com/googleapis/gax-go && \ | ||
cd /go/src/github.com/googleapis/gax-go && \ | ||
git reset --hard 9af46dd5a1713e8b5cd71106287eba3cefdde50b | ||
|
||
RUN go get -d golang.org/x/sync/errgroup && \ | ||
cd /go/src/golang.org/x/sync/errgroup && \ | ||
git reset --hard 457c5828408160d6a47e17645169cf8fa20218c4 | ||
|
||
RUN go get -d github.com/gregjones/httpcache && \ | ||
cd /go/src/github.com/gregjones/httpcache && \ | ||
git reset --hard d02018f006d98f58512bf3adfc171d88d17626df | ||
|
||
RUN go get -d go4.org/types && \ | ||
cd /go/src/go4.org && \ | ||
git reset --hard 7ce08ca145dbe0e66a127c447b80ee7914f3e4f9 | ||
|
||
COPY . /go/src/golang.org/x/build/ | ||
|
||
RUN go install -ldflags "-linkmode=external -extldflags '-static -pthread'" golang.org/x/build/cmd/gopherbot | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
# Copyright 2017 The Go Authors. All rights reserved. | ||
# Use of this source code is governed by a BSD-style | ||
# license that can be found in the LICENSE file. | ||
|
||
VERSION=latest | ||
DOCKER_IMAGE_build0=build0/gopherbot:latest | ||
DOCKER_CTR_build0=gopherbot-build0 | ||
|
||
build0: *.go Dockerfile.0 | ||
docker build --force-rm -f Dockerfile.0 --tag=$(DOCKER_IMAGE_build0) ../.. | ||
|
||
gopherbot: build0 | ||
docker create --name $(DOCKER_CTR_build0) $(DOCKER_IMAGE_build0) | ||
docker cp $(DOCKER_CTR_build0):/go/bin/$@ $@ | ||
docker rm $(DOCKER_CTR_build0) | ||
|
||
ca-certificates.crt: | ||
docker create --name $(DOCKER_CTR_build0) $(DOCKER_IMAGE_build0) | ||
docker cp $(DOCKER_CTR_build0):/etc/ssl/certs/$@ $@ | ||
docker rm $(DOCKER_CTR_build0) | ||
|
||
docker-prod: Dockerfile gopherbot ca-certificates.crt | ||
docker build --force-rm --tag=gcr.io/symbolic-datum-552/gopherbot:$(VERSION) . | ||
docker-dev: Dockerfile gopherbot ca-certificates.crt | ||
docker build --force-rm --tag=gcr.io/go-dashboard-dev/gopherbot:latest . | ||
|
||
push-prod: docker-prod | ||
gcloud docker -- push gcr.io/symbolic-datum-552/gopherbot:$(VERSION) | ||
push-dev: docker-dev | ||
gcloud docker -- push gcr.io/go-dashboard-dev/gopherbot:latest | ||
|
||
.PHONY: clean | ||
clean: | ||
$(RM) gopherbot | ||
$(RM) ca-certificates.crt |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
apiVersion: extensions/v1beta1 | ||
kind: Deployment | ||
metadata: | ||
name: gopherbot-deployment | ||
spec: | ||
replicas: 1 # more than 1 might cause duplicate GitHub comments | ||
template: | ||
metadata: | ||
labels: | ||
app: gopherbot | ||
spec: | ||
volumes: | ||
- name: cache-volume | ||
emptyDir: {} | ||
containers: | ||
- name: gopherbot | ||
image: gcr.io/symbolic-datum-552/gopherbot:latest | ||
imagePullPolicy: Always | ||
env: | ||
- name: XDG_CACHE_HOME | ||
value: "/cache" | ||
command: ["/gopherbot", "--daemon"] | ||
volumeMounts: | ||
- mountPath: /cache | ||
name: cache-volume | ||
resources: | ||
requests: | ||
cpu: "1" | ||
memory: "1Gi" | ||
limits: | ||
memory: "2Gi" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters