2020-11-10 20:37:11 +01:00
|
|
|
FROM golang:1.14 AS builder
|
|
|
|
RUN mkdir /build
|
|
|
|
WORKDIR /build
|
2019-07-23 22:15:42 +02:00
|
|
|
# Copy the code from the host and compile it
|
|
|
|
COPY . .
|
2018-07-23 17:04:06 +02:00
|
|
|
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 .
|
2020-11-10 20:37:11 +01: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
|
2018-07-23 17:04:06 +02:00
|
|
|
COPY --from=builder /app ./
|
2020-11-10 20:37:11 +01:00
|
|
|
COPY --from=builder /build/res ./
|
2018-07-23 17:04:06 +02:00
|
|
|
ENTRYPOINT ["./app"]
|