2020-05-08 22:09:51 +00:00
|
|
|
FROM golang:1.14 AS builder
|
|
|
|
|
|
|
|
RUN mkdir /build
|
|
|
|
WORKDIR /build
|
|
|
|
|
|
|
|
# Copy the code from the host and compile it
|
|
|
|
COPY . .
|
|
|
|
|
|
|
|
RUN mkdir res
|
|
|
|
COPY quotes.json res/quotes.json
|
|
|
|
|
|
|
|
RUN CGO_ENABLED=0 GOOS=linux go build -a -installsuffix nocgo -o /app .
|
|
|
|
|
2020-05-18 19:23:59 +00:00
|
|
|
FROM scratch
|
|
|
|
# We need ca-certifactes for http calls
|
|
|
|
COPY --from=builder /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/ca-certificates.crt
|
2020-05-08 22:09:51 +00:00
|
|
|
COPY --from=builder /app ./
|
|
|
|
COPY --from=builder /build/res ./
|
|
|
|
|
|
|
|
|
|
|
|
ENTRYPOINT ["./app"]
|