Skip to content

Commit

Permalink
Add config sources, environment variable config, and Dockerfile
Browse files Browse the repository at this point in the history
  • Loading branch information
Silas Davis committed Sep 29, 2017
1 parent 3fdbb1d commit f8c3820
Show file tree
Hide file tree
Showing 35 changed files with 597 additions and 2,039 deletions.
2 changes: 1 addition & 1 deletion .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ jobs:
tag: /.*/
working_directory: /go/src/github.com/monax/hoard
docker:
- image: silasdavis/hoard:build
- image: quay.io/monax/hoard:build
steps:
- checkout
- run: make build_ci
Expand Down
39 changes: 26 additions & 13 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,13 +1,26 @@
FROM circleci/golang:1.8

# This Dockerfile is to generate the docker build image for CI services
# See the update_docker_image Make target

RUN curl -OL https://github.com/google/protobuf/releases/download/v3.3.0/protoc-3.3.0-linux-x86_64.zip
RUN unzip protoc-3.3.0-linux-x86_64.zip -d protobuf
RUN sudo cp protobuf/bin/protoc /usr/bin/protoc
RUN rm -rf protobuf protoc-*
RUN go get -u golang.org/x/tools/cmd/goimports
RUN go get -u github.com/golang/protobuf/protoc-gen-go
RUN go get -u github.com/Masterminds/glide
RUN go get -u github.com/goreleaser/goreleaser
# We use a multistage build to avoid bloating our deployment image with build dependencies
FROM golang:1.9.0-alpine3.6 as builder
MAINTAINER Monax <[email protected]>

RUN apk add --no-cache --update git

ARG REPO=$GOPATH/src/github.com/monax/hoard
COPY . $REPO
WORKDIR $REPO

# Build purely static binaries
RUN go build --ldflags '-extldflags "-static"' -o bin/hoard ./cmd/hoard

# This will be our base container image
FROM alpine:3.6

ARG REPO=/go/src/github.com/monax/hoard

# Copy binaries built in previous stage
COPY --from=builder $REPO/bin/* /usr/local/bin/

EXPOSE 53431

ENV HOARD_JSON_CONFIG '{"ListenAddress":"tcp://:53431","Storage":{"StorageType":"memory","AddressEncoding":"base64"},"Logging":{"LoggingType":"logfmt","Channels":["info","trace"]}}'

CMD [ "hoard", "-e", "-l" ]
140 changes: 140 additions & 0 deletions Gopkg.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

74 changes: 74 additions & 0 deletions Gopkg.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@

# Gopkg.toml example
#
# Refer to https://github.com/golang/dep/blob/master/docs/Gopkg.toml.md
# for detailed Gopkg.toml documentation.
#
# required = ["github.com/user/thing/cmd/thing"]
# ignored = ["github.com/user/project/pkgX", "bitbucket.org/user/project/pkgA/pkgY"]
#
# [[constraint]]
# name = "github.com/user/project"
# version = "1.0.0"
#
# [[constraint]]
# name = "github.com/user/project2"
# branch = "dev"
# source = "github.com/myfork/project2"
#
# [[override]]
# name = "github.com/x/y"
# version = "2.4.0"


[[constraint]]
name = "github.com/BurntSushi/toml"
version = "0.3.0"

[[constraint]]
name = "github.com/OneOfOne/xxhash"
version = "1.2.0"

[[constraint]]
name = "github.com/aws/aws-sdk-go"
version = "1.12.1"

[[constraint]]
branch = "master"
name = "github.com/cep21/xdgbasedir"

[[constraint]]
name = "github.com/eapache/channels"
version = "1.1.0"

[[constraint]]
name = "github.com/go-kit/kit"
version = "0.5.0"

[[constraint]]
name = "github.com/go-stack/stack"
version = "1.6.0"

[[constraint]]
branch = "master"
name = "github.com/golang/protobuf"

[[constraint]]
name = "github.com/jawher/mow.cli"
version = "1.0.2"

[[constraint]]
name = "github.com/stretchr/testify"
version = "1.1.4"

[[constraint]]
branch = "master"
name = "golang.org/x/crypto"

[[constraint]]
branch = "master"
name = "golang.org/x/net"

[[constraint]]
name = "google.golang.org/grpc"
version = "1.6.0"
7 changes: 3 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ GOPACKAGES_NOVENDOR := $(shell go list ./... | grep -v /vendor/)
OS_ARCHS := "linux/arm linux/386 linux/amd64 darwin/386 darwin/amd64 windows/386 windows/amd64"
DIST := "dist"
GOX_OUTPUT := "$DIST/{{.Dir}}_{{.OS}}_{{.Arch}}"
BUILD_IMAGE := "silasdavis/hoard:build"
BUILD_IMAGE := "quay.io/monax/hoard:build"

# Install dependencies and also clear out vendor (we should do this in CI)

Expand All @@ -33,7 +33,7 @@ BUILD_IMAGE := "silasdavis/hoard:build"
.PHONY: ensure_vendor
ensure_vendor:
@rm -rf vendor
@glide install
@dep ensure -v

# to make sure we are not depending on any local changes to dependencies in
# vendor/
Expand All @@ -48,7 +48,7 @@ deps:
# and pushing it to docker
.PHONY: update_build_image
update_build_image:
@docker build . -t ${BUILD_IMAGE}
@docker build ./docker/ci -t ${BUILD_IMAGE}
@docker push ${BUILD_IMAGE}

# Print version
Expand Down Expand Up @@ -76,7 +76,6 @@ fix:
.PHONY: build_protobuf
build_protobuf: ./core/hoard.pb.go


# Build the hoard binary
.PHONY: build_hoard
build_hoard:
Expand Down
Loading

0 comments on commit f8c3820

Please sign in to comment.