feat: add Dockerfile

This commit is contained in:
Dawid Wysokiński 2022-06-01 06:53:14 +02:00
parent 636c363231
commit adda715d95
Signed by: Kichiyaki
GPG Key ID: 1ECC5DE481BE5184
1 changed files with 25 additions and 0 deletions

25
Dockerfile Normal file
View File

@ -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=5s --retries=3 \
CMD curl --fail http://localhost:9234/health || exit 1
CMD ["./lubimyczytacrss"]