Skip to content
This repository has been archived by the owner on Jul 22, 2024. It is now read-only.

Commit

Permalink
Merge pull request segmentio#266 from segmentio/yolken-add-dockerignore
Browse files Browse the repository at this point in the history
Ignore .git in images
  • Loading branch information
yolken-segment authored Jun 11, 2020
2 parents 2e4e57a + 5523fa4 commit 62a8008
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 7 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
7 changes: 5 additions & 2 deletions 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 . .

RUN apk add -U make git
RUN make linux
ARG VERSION
RUN test -n "${VERSION}"

RUN apk add -U make
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 62a8008

Please sign in to comment.