Skip to content

Commit

Permalink
Update deps and build with commit hash
Browse files Browse the repository at this point in the history
Signed-off-by: Silas Davis <[email protected]>
  • Loading branch information
Silas Davis committed Nov 28, 2019
1 parent f569f91 commit a0f05b2
Show file tree
Hide file tree
Showing 7 changed files with 535 additions and 1,172 deletions.
5 changes: 2 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,15 @@
FROM golang:1.12.1-alpine3.9 as builder
MAINTAINER Monax <[email protected]>

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

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

ENV GO111MODULE=on
# Build purely static binaries
RUN go build --ldflags '-extldflags "-static"' -o bin/hoard ./cmd/hoard
RUN go build --ldflags '-extldflags "-static"' -o bin/hoarctl ./cmd/hoarctl
RUN make build

# This will be our base container image
FROM alpine:3.9
Expand Down
21 changes: 14 additions & 7 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,10 @@

export GO111MODULE := on

# Gets implicit default GOPATH if not set
GOPATH?=$(shell go env GOPATH)
BIN_PATH?=${GOPATH}/bin

SHELL := /bin/bash
REPO := $(shell pwd)
GOFILES := $(shell find . -name '*.pb.go' -prune -o -not -path './vendor/*' -type f -name '*.go' -print)
Expand All @@ -29,6 +33,8 @@ PROTO_FILES = $(shell find . -path ./hoard-js -prune -o -path ./node_modules -pr
PROTO_GO_FILES = $(patsubst %.proto, %.pb.go, $(PROTO_FILES))
PROTO_GO_FILES_REAL = $(shell find . -type f -name '*.pb.go' -print)

GO_BUILD_ARGS = -ldflags "-extldflags '-static' -X $(shell go list)/project.commit=$(shell cat commit_hash.txt) -X $(shell go list)/project.date=$(shell date '+%Y-%m-%d')"

export DOCKER_HUB := quay.io
export DOCKER_REPO := $(DOCKER_HUB)/monax/hoard
export BUILD_IMAGE := $(DOCKER_REPO):build
Expand Down Expand Up @@ -85,18 +91,19 @@ protobuf_deps:

## build the hoard binary
.PHONY: build_hoard
build_hoard:
@go build -o bin/hoard ./cmd/hoard
build_hoard: commit_hash
go build $(GO_BUILD_ARGS) -o bin/hoard ./cmd/hoard

## build the hoard binary
.PHONY: build_hoarctl
build_hoarctl:
@go build -o bin/hoarctl ./cmd/hoarctl
build_hoarctl: commit_hash
go build $(GO_BUILD_ARGS) -o bin/hoarctl ./cmd/hoarctl

.PHONY: install
install:
@go install ./cmd/hoard
@go install ./cmd/hoarctl
install: build_hoarctl build_hoard
mkdir -p ${BIN_PATH}
install -T ${REPO}/bin/hoarctl ${BIN_PATH}/hoarctl
install -T ${REPO}/bin/hoard ${BIN_PATH}/hoard

## build all targets in github.com/monax/hoard
.PHONY: build
Expand Down
28 changes: 11 additions & 17 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -2,32 +2,26 @@ module github.com/monax/hoard/v6

go 1.13

replace git.apache.org/thrift.git => github.com/apache/thrift v0.0.0-20180902110319-2566ecd5d999

require (
cloud.google.com/go v0.37.0
github.com/Azure/azure-storage-blob-go v0.6.0
github.com/Azure/azure-storage-blob-go v0.8.0
github.com/BurntSushi/toml v0.3.1
github.com/OneOfOne/xxhash v1.2.5
github.com/aws/aws-sdk-go v1.19.35
github.com/OneOfOne/xxhash v1.2.6
github.com/aws/aws-sdk-go v1.25.43
github.com/cep21/xdgbasedir v0.0.0-20170329171747-21470bfc93b9
github.com/eapache/channels v1.1.0
github.com/eapache/queue v1.1.0 // indirect
github.com/go-kit/kit v0.9.0
github.com/go-logfmt/logfmt v0.4.0 // indirect
github.com/go-stack/stack v1.8.0
github.com/gogo/protobuf v1.3.0
github.com/gogo/protobuf v1.3.1
github.com/golang/protobuf v1.3.2
github.com/h2non/filetype v1.0.10
github.com/jawher/mow.cli v1.1.0
github.com/monax/hoard/v5 v5.1.0 // indirect
github.com/monax/relic v2.0.0+incompatible
github.com/stretchr/testify v1.4.0
gocloud.dev v0.13.0
golang.org/x/crypto v0.0.0-20191002192127-34f69633bfdc
golang.org/x/net v0.0.0-20191009170851-d66e71096ffb // indirect
golang.org/x/oauth2 v0.0.0-20190517181255-950ef44c6e07
golang.org/x/sys v0.0.0-20191009170203-06d7bd2c5f4f // indirect
google.golang.org/api v0.2.0
google.golang.org/genproto v0.0.0-20191009194640-548a555dbc03 // indirect
google.golang.org/grpc v1.24.0
gopkg.in/yaml.v2 v2.2.4
gocloud.dev v0.18.0
golang.org/x/crypto v0.0.0-20191122220453-ac88ee75c92c
golang.org/x/oauth2 v0.0.0-20191122200657-5d9234df094c
google.golang.org/grpc v1.25.1
gopkg.in/yaml.v2 v2.2.7
)
Loading

0 comments on commit a0f05b2

Please sign in to comment.