mirror of
https://github.com/TwiN/gatus.git
synced 2024-11-21 23:43:27 +01:00
4a84368d24
- using COPY instead of ADD, since working with local paths, and not extracting archived data - installing packages before building application binary improves caching, and avoids installing packages every time the application code changes Signed-off-by: Anastas Dancha <anapsix@random.io>
21 lines
720 B
Docker
21 lines
720 B
Docker
# Build the go application into a binary
|
|
FROM golang:alpine as builder
|
|
RUN apk --update add ca-certificates
|
|
WORKDIR /app
|
|
COPY . ./
|
|
RUN CGO_ENABLED=0 GOOS=linux go build -mod vendor -a -installsuffix cgo -o gatus .
|
|
|
|
# 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
|
|
|
|
# Run the binary on an empty container
|
|
FROM scratch
|
|
COPY --from=builder /app/gatus .
|
|
COPY --from=builder /app/config.yaml ./config/config.yaml
|
|
COPY --from=builder /app/static static/
|
|
COPY --from=builder /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/ca-certificates.crt
|
|
ENV PORT=8080
|
|
EXPOSE ${PORT}
|
|
ENTRYPOINT ["/gatus"]
|