From 50e51d7bbf6c68661b9fb510f1b296bf4ec18d11 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dawid=20Wysoki=C5=84ski?= Date: Wed, 1 Jun 2022 07:18:59 +0200 Subject: [PATCH] feat: add Dockerfile (#5) --- Dockerfile | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 Dockerfile diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..129b701 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,25 @@ +FROM golang:1.18.2-alpine3.16 as builder + +WORKDIR /app/lubimyczytacrss + +COPY go.mod go.sum ./ +RUN go mod download + +COPY . . +RUN CGO_ENABLED=0 go build -o lubimyczytacrss . + +######## Start a new stage from scratch ####### +FROM alpine:3.16 + +WORKDIR /app/lubimyczytacrss + +RUN apk --no-cache add ca-certificates + +COPY --from=builder /app/lubimyczytacrss/lubimyczytacrss . + +EXPOSE 9234/tcp + +HEALTHCHECK --interval=30s --timeout=10s --retries=3 \ + CMD wget --no-verbose --tries=1 --spider http://localhost:9234/health || exit 1 + +CMD ["./lubimyczytacrss"]