2019-09-15 01:25:59 +02:00
|
|
|
# Build the go application into a binary
|
|
|
|
FROM golang:alpine as builder
|
2020-11-16 15:19:12 +01:00
|
|
|
RUN apk --update add ca-certificates
|
2019-09-15 01:25:59 +02:00
|
|
|
WORKDIR /app
|
2020-11-16 15:19:12 +01:00
|
|
|
COPY . ./
|
2019-09-15 01:25:59 +02:00
|
|
|
RUN CGO_ENABLED=0 GOOS=linux go build -mod vendor -a -installsuffix cgo -o gatus .
|
|
|
|
|
2020-11-14 15:55:37 +01:00
|
|
|
# Run Tests inside docker image if you don't have a configured go environment
|
|
|
|
#RUN apk update && apk add --virtual build-dependencies build-base gcc
|
|
|
|
#RUN go test ./... -mod vendor
|
|
|
|
|
2019-09-15 01:25:59 +02:00
|
|
|
# Run the binary on an empty container
|
|
|
|
FROM scratch
|
|
|
|
COPY --from=builder /app/gatus .
|
2019-12-28 18:55:00 +01:00
|
|
|
COPY --from=builder /app/config.yaml ./config/config.yaml
|
2021-01-30 05:10:20 +01:00
|
|
|
COPY --from=builder /app/web/static ./web/static
|
2019-09-15 01:25:59 +02:00
|
|
|
COPY --from=builder /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/ca-certificates.crt
|
2019-12-04 23:10:04 +01:00
|
|
|
ENV PORT=8080
|
|
|
|
EXPOSE ${PORT}
|
2020-11-16 15:19:12 +01:00
|
|
|
ENTRYPOINT ["/gatus"]
|