File tree Expand file tree Collapse file tree 4 files changed +31
-21
lines changed
Expand file tree Collapse file tree 4 files changed +31
-21
lines changed Original file line number Diff line number Diff line change 11*
2- ! _build /relay
3- ! docker /relay.conf
Original file line number Diff line number Diff line change 1- FROM gliderlabs/ alpine:latest
1+ FROM alpine:3.4
22
33MAINTAINER Kevin Smith <kevin@operable.io>
44
5- COPY _build/relay /usr/local/bin/relay
6- COPY docker/relay.conf /usr/local/etc/relay.conf
5+ ARG GIT_COMMIT
6+ ENV GIT_COMMIT ${GIT_COMMIT:-master}
77
8- # RUN chmod +x /usr/local/bin/relay
8+ RUN mkdir -p /root/golang/src/github.com/operable/ && \
9+ cd /root/golang/src/github.com/operable && \
10+ apk add -U --no-cache git go make ca-certificates && \
11+ git clone https://github.com/operable/go-relay && \
12+ cd go-relay && git checkout $GIT_COMMIT && \
13+ GOPATH=/root/golang make exe && \
14+ cp _build/relay /usr/local/bin && \
15+ mkdir -p /usr/local/etc && \
16+ cp docker/relay.conf /usr/local/etc/relay.conf && \
17+ cd /root && rm -rf golang && \
18+ apk del --force --rdepends --purge go make git && rm -rf /var/cache/apk/*
919
10- # Ensure latest CA certs are available
11- RUN apk-install ca-certificates && chmod +x /usr/local/bin/relay
Original file line number Diff line number Diff line change @@ -6,22 +6,14 @@ SOURCES := $(shell find . -name "*.go" -type f)
66VET_FLAGS = -v
77BUILD_STAMP := $(shell date -u '+% Y% m% d% H% M% S')
88BUILD_HASH := $(shell git rev-parse HEAD)
9- BUILD_TAG ?= $(shell git describe --tags )
9+ BUILD_TAG ?= $(shell scripts/build_tag.sh )
1010DRIVER_TAG ?= 0.9.1
11- DOCKER_IMAGE ?= "operable/relay:dev "
11+ DOCKER_IMAGE ?= "operable/relay:$( BUILD_TAG ) "
1212LINK_VARS := -X main.buildstamp=$(BUILD_STAMP ) -X main.buildhash=$(BUILD_HASH )
1313LINK_VARS += -X main.buildtag=$(BUILD_TAG ) -X main.commanddrivertag=$(DRIVER_TAG )
14- OSNAME := $(shell uname | tr A-Z a-z)
15- ARCHNAME := $(shell $(CC ) -dumpmachine | cut -d\- -f1)
1614BUILD_DIR = _build
1715EXENAME = relay
1816
19- ifeq ($(ARCHNAME ) , x86_64)
20- ARCHNAME = amd64
21- endif
22- TARBALL_NAME = $(EXENAME ) _$(OSNAME ) _$(ARCHNAME )
23-
24-
2517ifdef FORCE
2618.PHONY : all tools lint test clean deps relay docker
2719else
@@ -70,9 +62,8 @@ $(TARBALL_NAME): test exe
7062 tar czf $(TARBALL_NAME ) .tar.gz $(TARBALL_NAME )
7163 rm -rf $(TARBALL_NAME )
7264
73- docker : clean
74- GOOS=linux GOARCH=amd64 make deps exe
75- docker build -t $(DOCKER_IMAGE ) .
65+ docker :
66+ docker build --build-arg=GIT_COMMIT=$(BUILD_HASH ) -t $(DOCKER_IMAGE ) .
7667
7768$(BUILD_DIR ) :
7869 mkdir -p $@
Original file line number Diff line number Diff line change 1+ #! /bin/sh
2+
3+ # git describe --tags appends SHA info to
4+ # prior tag. This subcommand detects when that
5+ # happens.
6+ tag=` git describe --tags`
7+ dash_count=` git describe --tags | grep -o - | wc -l | sed " s/ //g" `
8+
9+ if [ " $dash_count " != " 0" ]; then
10+ tag=" dev"
11+ fi
12+
13+ echo $tag
You can’t perform that action at this time.
0 commit comments