Skip to content
This repository has been archived by the owner on Jan 16, 2025. It is now read-only.

Commit

Permalink
add a release task to Makefile
Browse files Browse the repository at this point in the history
  • Loading branch information
okushchenko committed Oct 10, 2017
1 parent c5c51d2 commit da74bb7
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 4 deletions.
4 changes: 2 additions & 2 deletions Dockerfile.build.alpine
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
FROM golang:1.9-alpine
FROM golang:1.9.1-alpine

RUN apk add --no-cache make
RUN apk add --no-cache make git
RUN mkdir -p /go/src/github.com/kelseyhightower/confd && \
ln -s /go/src/github.com/kelseyhightower/confd /app

Expand Down
13 changes: 11 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
.PHONY: build install clean test integration dep
.PHONY: build install clean test integration dep release
VERSION=`egrep -o '[0-9]+\.[0-9a-z.\-]+' version.go`
GIT_SHA=`git rev-parse --short HEAD`

build:
@echo "Building confd..."
@mkdir -p bin
@go build -ldflags "-X main.GitSHA=`git rev-parse --short HEAD`" -o bin/confd .
@go build -ldflags "-X main.GitSHA=${GIT_SHA}" -o bin/confd .

install:
@echo "Installing confd..."
Expand All @@ -23,3 +25,10 @@ integration:
dep:
@dep ensure
@dep prune

release:
@docker build -q -t confd_builder -f Dockerfile.build.alpine .
@for platform in darwin linux windows; do \
if [ $$platform == windows ]; then extension=.exe; fi; \
docker run -it --rm -v ${PWD}:/app -e "GOOS=$$platform" -e "GOARCH=amd64" -e "CGO_ENABLED=0" confd_builder go build -ldflags="-s -w -X main.GitSHA=${GIT_SHA}" -o bin/confd-${VERSION}-$$platform-amd64$$extension; \
done

0 comments on commit da74bb7

Please sign in to comment.