Skip to content

Commit

Permalink
Merge pull request #17 from krasi-georgiev/dockerfile
Browse files Browse the repository at this point in the history
use multistage builds and build inside a container
  • Loading branch information
stephen-soltesz authored Aug 2, 2018
2 parents 010edf1 + 019e883 commit 2d57a94
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 6 deletions.
3 changes: 3 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@ before_install:
- go get github.com/mattn/goveralls
- go get github.com/wadey/gocovmerge

install:
- go get -t ./...

# Unconditionally place the repo at GOPATH/src/${go_import_path} to support
# forks.
go_import_path: github.com/m-lab/alertmanager-github-receiver
Expand Down
17 changes: 11 additions & 6 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,9 +1,14 @@
FROM golang:1.8
FROM golang:1.10

ADD . /go/src/github.com/m-lab/alertmanager-github-receiver
WORKDIR /go/src/github.com/m-lab/alertmanager-github-receiver
ADD . ./

# TODO(soltesz): vendor dependencies.
RUN go get -v github.com/m-lab/alertmanager-github-receiver/cmd/github_receiver
# TODO(soltesz): Use vgo for dependencies.
RUN CGO_ENABLED=0 go get -v github.com/m-lab/alertmanager-github-receiver/cmd/github_receiver

# RUN go install -v
ENTRYPOINT ["/go/bin/github_receiver"]
FROM alpine
RUN apk add --no-cache ca-certificates && \
update-ca-certificates
WORKDIR /
COPY --from=0 /go/bin/github_receiver ./
ENTRYPOINT ["/github_receiver"]
3 changes: 3 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
docker:
@docker build -t $(DOCKER_TAG) .
@docker push $(DOCKER_TAG)
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,12 @@ The alertmanager github receiver creates GitHub issues using
[Alertmanager](https://github.com/prometheus/alertmanager) webhook
notifications.

# Build
```
make docker DOCKER_TAG=repo/imageName
```
This will build the binary and push it to repo/imageName.

# Setup

## Create GitHub access token
Expand Down

0 comments on commit 2d57a94

Please sign in to comment.