Files
query-orchestration/build/Dockerfile
T
Michael McGuinness 76e4f5790f Merged in feature/health (pull request #163)
Health Endpoint

* health
2025-06-09 23:30:06 +00:00

58 lines
1.1 KiB
Docker

# syntax=docker/dockerfile:1
ARG GO_VERSION=1.24.0
FROM golang:${GO_VERSION} AS build
WORKDIR /app
RUN mkdir bin/
RUN apt-get update && \
apt-get install -y --no-install-recommends git=1:2.* musl-tools=1.2.* && \
apt-get clean && \
rm -rf /var/lib/apt/lists/*
RUN go install -a -installsuffix cgo std
COPY --link go.mod .
COPY --link go.sum .
COPY --link vendor/ vendor/
RUN go mod verify
COPY --link cmd/ cmd/
COPY --link api/ api/
COPY --link internal/ internal/
ARG TARGETARCH
ENV CGO_ENABLED=1
ENV GOARCH=${TARGETARCH}
ENV CC=musl-gcc
ARG GIT_VERSION=dev
ARG GIT_COMMIT=unknown
RUN go build \
-mod vendor \
-tags musl \
-trimpath \
-installsuffix cgo \
-ldflags "-s -w -linkmode external -extldflags '-static -Wl,--as-needed -Wl,--gc-sections -Wl,-O1' -X main.version=${GIT_VERSION} -X main.gitCommit=${GIT_COMMIT}" \
-o bin/ ./cmd/...
FROM scratch AS final
ENV PWD=/app
WORKDIR ${PWD}
COPY --from=build /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/
COPY --from=build /app/bin/ .
EXPOSE 8080
HEALTHCHECK --interval=3s --timeout=3s --start-period=1s --retries=10 \
CMD ["./healthcheck"]