forked from grammarly/rocker
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Rockerfile
58 lines (41 loc) · 1.21 KB
/
Rockerfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
FROM golang:1.5.1
{{ assert .Version }}
{{ $stable := "0.2.3" }}
{{ $beta := "0.2.4" }}
{{ $v1 := "1.0." }}
ADD . /src
WORKDIR /src
ENV CGO_ENABLED=0 GOOS=linux GOARCH=amd64
{{ if .test }}
MOUNT /var/run/docker.sock:/var/run/docker.sock
{{ if .TestArgs }}
ENV TESTARGS="{{ .TestArgs }}"
{{ end }}
ATTACH ["bash"]
RUN make test
{{ end }}
RUN \
TIME=$(TZ=GMT date "+%Y-%m-%d_%H:%M_GMT") \
GOPATH=/src:/src/vendor \
go build \
-a -installsuffix cgo \
-ldflags "-X main.Version={{ .Version }} -X main.GitCommit=$commit -X main.GitBranch=$branch -X main.BuildTime=$TIME" \
-v -o /bin/rocker src/cmd/rocker/main.go
EXPORT /bin/rocker
#========
FROM alpine:3.2
RUN apk --update add git bash
RUN mkdir -p /opt/rocker/bin
IMPORT rocker /opt/rocker/bin
VOLUME ["/opt/rocker/bin"]
WORKDIR /context
ENV PATH=/opt/rocker/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
CMD ["/opt/rocker/bin/rocker"]
PUSH dockerhub.grammarly.io/rocker:{{ .Version }}
{{ if hasPrefix .Version $stable }}
PUSH dockerhub.grammarly.io/rocker:stable
{{ else if hasPrefix .Version $beta }}
PUSH dockerhub.grammarly.io/rocker:beta
{{ else if hasPrefix .Version $v1 }}
PUSH dockerhub.grammarly.io/rocker:v1
{{ end }}