22 lines
439 B
Docker
22 lines
439 B
Docker
FROM golang:1.22.5-alpine AS build
|
|
WORKDIR /src
|
|
|
|
COPY src/go.mod src/go.sum ./
|
|
RUN go mod download
|
|
|
|
COPY src/ ./
|
|
|
|
RUN CGO_ENABLED=0 GOOS=linux go build -trimpath -ldflags="-s -w" -o /out/messenger .
|
|
|
|
|
|
FROM scratch
|
|
USER 10001:10001
|
|
|
|
COPY --from=build /out/messenger /app/messenger
|
|
|
|
EXPOSE 8080
|
|
HEALTHCHECK --interval=5s --timeout=3s --start-period=10s --retries=5 \
|
|
CMD ["/app/messenger", "-healthcheck"]
|
|
|
|
ENTRYPOINT ["/app/messenger"]
|