Skip to content

Commit

Permalink
Ignore .git in images
Browse files Browse the repository at this point in the history
  • Loading branch information
yolken-segment committed Jun 9, 2020
1 parent 2e4e57a commit 1cdcdc9
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 6 deletions.
3 changes: 3 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
.git
.github
.circleci
5 changes: 4 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,11 @@ FROM golang:1.13-alpine AS build
WORKDIR /go/src/github.com/segmentio/chamber
COPY . .

ARG VERSION
RUN test -n "${VERSION}"

RUN apk add -U make git
RUN make linux
RUN make linux VERSION=${VERSION}

FROM scratch AS run

Expand Down
13 changes: 8 additions & 5 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,14 @@
#
# This makefile is meant for humans

VERSION := $(shell git describe --tags --always --dirty="-dev")
VERSION_NO_V := $(shell git describe --tags --always --dirty="-dev" | sed 's/^v//')
VERSION_MAJOR_MINOR_PATCH := $(shell git describe --tags --always --dirty="-dev" | sed 's/^v\([0-9]*.[0-9]*.[0-9]*\).*/\1/')
VERSION_MAJOR_MINOR := $(shell git describe --tags --always --dirty="-dev" | sed 's/^v\([0-9]*.[0-9]*\).*/\1/')
VERSION_MAJOR := $(shell git describe --tags --always --dirty="-dev" | sed 's/^v\([0-9]*\).*/\1/')
ifndef VERSION
VERSION := $(shell git describe --tags --always --dirty="-dev")
endif

VERSION_NO_V := $(shell echo "$(VERSION)" | sed 's/^v//')
VERSION_MAJOR_MINOR_PATCH := $(shell echo "$(VERSION)" | sed 's/^v\([0-9]*.[0-9]*.[0-9]*\).*/\1/')
VERSION_MAJOR_MINOR := $(shell echo "$(VERSION)" | sed 's/^v\([0-9]*.[0-9]*\).*/\1/')
VERSION_MAJOR := $(shell echo "$(VERSION)" | sed 's/^v\([0-9]*\).*/\1/')
ANALYTICS_WRITE_KEY ?=
LDFLAGS := -ldflags='-X "main.Version=$(VERSION)" -X "main.AnalyticsWriteKey=$(ANALYTICS_WRITE_KEY)"'

Expand Down
1 change: 1 addition & 0 deletions Makefile.release
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,7 @@ publish-dockerhub:
-t segment/chamber:$(DOCKERHUB_TAG_PREFIX)$(VERSION_MAJOR_MINOR) \
-t segment/chamber:$(DOCKERHUB_TAG_PREFIX)$(VERSION_MAJOR) \
-t segment/chamber:$(DOCKERHUB_TAG_PREFIX)$(VERSION_NO_V) \
--build-arg VERSION=$(VERSION) \
.
docker push segment/chamber:$(DOCKERHUB_TAG_PREFIX)$(VERSION_MAJOR_MINOR_PATCH)
docker push segment/chamber:$(DOCKERHUB_TAG_PREFIX)$(VERSION_MAJOR_MINOR)
Expand Down

0 comments on commit 1cdcdc9

Please sign in to comment.