2018-07-23 17:04:06 +02:00
|
|
|
FROM golang:1.10 AS builder
|
|
|
|
|
|
|
|
# Download and install the latest release of dep
|
|
|
|
# ADD https://github.com/golang/dep/releases/download/v0.4.1/dep-linux-amd64 /usr/bin/dep
|
|
|
|
# RUN chmod +x /usr/bin/dep
|
|
|
|
|
|
|
|
# Copy the code from the host and compile it
|
|
|
|
COPY . ./
|
|
|
|
|
|
|
|
RUN go get -v -d ./...
|
|
|
|
|
|
|
|
RUN mkdir res
|
|
|
|
|
|
|
|
COPY settings.json res
|
2018-11-14 00:35:25 +01:00
|
|
|
COPY quotes.json res
|
2018-07-23 17:04:06 +02:00
|
|
|
|
|
|
|
RUN CGO_ENABLED=0 GOOS=linux go build -a -installsuffix nocgo -o /app .
|
|
|
|
|
|
|
|
# We use Alpine for it's ca-certificates needed by http lib
|
|
|
|
FROM alpine:3.4
|
|
|
|
RUN apk add --no-cache ca-certificates apache2-utils
|
|
|
|
COPY --from=builder /app ./
|
|
|
|
COPY --from=builder /go/res ./
|
|
|
|
|
|
|
|
|
|
|
|
ENTRYPOINT ["./app"]
|