-
Notifications
You must be signed in to change notification settings - Fork 2
/
Dockerfile
42 lines (33 loc) · 977 Bytes
/
Dockerfile
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
# Build Step
FROM golang:1.10 AS build
# Prerequisites
WORKDIR /go/src/github.com/stjohnjohnson/reddit-watcher
RUN go get -u github.com/golang/dep/cmd/dep
RUN go get -u github.com/screwdriver-cd/gitversion
# Compilation target
ENV GOOS=linux
ENV GOARCH=amd64
ENV CGO_ENABLED=0
# Add code and install deps
COPY . /go/src/github.com/stjohnjohnson/reddit-watcher
RUN dep ensure -vendor-only
# Build the app
RUN go build \
-o /reddit-watcher \
-a -installsuffix cgo \
-ldflags "\
-X main.version=`gitversion show` \
-X main.commit=`git rev-parse HEAD` \
-X main.date=`date -u +"%Y-%m-%dT%H:%M:%SZ"`\
"
# Executable stage
FROM alpine:3.7
# Ensure we can call HTTPS endpoints
RUN apk add --update ca-certificates \
&& rm -rf /var/cache/apk/*
# Copy binary from build step
COPY --from=build /reddit-watcher /usr/bin/
# Persist data in this directory
VOLUME /config
# Specify our launch point
ENTRYPOINT ["/usr/bin/reddit-watcher"]