saw that there is a health endpoint available (yes it doesn't do much currently) so i wondered why not have a health check
registered in the dockerfile for it?
It would mean that the container can be seen as unhealthy if it isn't responding with a 200 on that endpoint. (and the endpoint can be extended in the future to do more intricate checks)
something like:
# build image
FROM golang:alpine as build
WORKDIR /go/src/github.com/Admiral-Piett/goaws
COPY ./app/ ./app/
COPY ./go.mod .
COPY ./go.sum .
RUN ls -la
RUN CGO_ENABLED=0 go test ./app/...
RUN go build -o goaws app/cmd/goaws.go
# release image
FROM alpine
COPY --from=build /go/src/github.com/Admiral-Piett/goaws/goaws /goaws
COPY app/conf/goaws.yaml /conf/
EXPOSE 4100
HEALTHCHECK --interval=1s --timeout=3s --start-period=5s --retries=15 \
CMD wget --no-verbose --tries=1 --spider http://localhost:4100/health || exit 1
ENTRYPOINT ["/goaws"]
your current base alpine already have wget installed currently, you can of course make sure it is installed during building of the Dockerfile by adding in the release image part
RUN apk add --no-cache wget
saw that there is a health endpoint available (yes it doesn't do much currently) so i wondered why not have a health check registered in the dockerfile for it? It would mean that the container can be seen as unhealthy if it isn't responding with a 200 on that endpoint. (and the endpoint can be extended in the future to do more intricate checks)
something like:
your current base
alpine
already have wget installed currently, you can of course make sure it is installed during building of the Dockerfile by adding in the release image partRUN apk add --no-cache wget