Skip to content

Commit

Permalink
Migrate to micro container
Browse files Browse the repository at this point in the history
  • Loading branch information
g3kk0 committed Sep 6, 2017
1 parent 7615b8a commit a3294a4
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 20 deletions.
12 changes: 6 additions & 6 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
FROM golang:1.8.2-alpine

FROM golang:1.9.0-alpine3.6 as compiler
RUN apk add --update git && apk add --update make && rm -rf /var/cache/apk/*

ADD . /go/src/github.com/${GITHUB_ORG:-ernestio}/monit
WORKDIR /go/src/github.com/${GITHUB_ORG:-ernestio}/monit
RUN make deps && CGO_ENABLED=0 go install -a -ldflags '-s' .

RUN make deps && go install

ENTRYPOINT ./entrypoint.sh
FROM scratch
COPY --from=compiler /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/ca-certificates.crt
COPY --from=compiler /go/bin/monit .
ENTRYPOINT ["./monit"]
1 change: 1 addition & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ deps:
go get github.com/nats-io/nats
go get github.com/dgrijalva/jwt-go
go get github.com/r3labs/pattern
go get github.com/ernestio/ernest-config-client

dev-deps: deps
go get github.com/smartystreets/goconvey/convey
Expand Down
7 changes: 0 additions & 7 deletions entrypoint.sh

This file was deleted.

10 changes: 3 additions & 7 deletions setup.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,10 @@ package main

import (
"encoding/json"
"log"
"os"
"time"

"github.com/nats-io/nats"
ecc "github.com/ernestio/ernest-config-client"
)

type monitorConfig struct {
Expand All @@ -21,11 +20,8 @@ type monitorConfig struct {
func setup() {
var err error
// Open Nats connection
nc, err = nats.Connect(os.Getenv("NATS_URI"))
if err != nil {
log.Println("Could not connect to nats")
return
}
ec := ecc.NewConfig(os.Getenv("NATS_URI"))
nc = ec.Nats()

secret = os.Getenv("JWT_SECRET")
if secret == "" {
Expand Down

0 comments on commit a3294a4

Please sign in to comment.