2024-12-19 11:38:57 +00:00
|
|
|
# syntax=docker/dockerfile:1
|
|
|
|
|
|
2025-03-06 22:33:39 +00:00
|
|
|
ARG GO_VERSION=1.24.0
|
2025-01-10 12:58:14 +00:00
|
|
|
|
2024-12-19 11:38:57 +00:00
|
|
|
FROM golang:${GO_VERSION} AS build
|
2025-01-10 12:58:14 +00:00
|
|
|
|
|
|
|
|
WORKDIR /app
|
2024-12-19 11:38:57 +00:00
|
|
|
|
2025-06-02 10:44:45 +00:00
|
|
|
RUN mkdir bin/
|
|
|
|
|
|
2025-04-22 14:40:16 +00:00
|
|
|
RUN apt-get update && \
|
2025-06-02 10:44:45 +00:00
|
|
|
apt-get install -y --no-install-recommends git=1:2.* musl-tools=1.2.* && \
|
|
|
|
|
apt-get clean && \
|
|
|
|
|
rm -rf /var/lib/apt/lists/*
|
2025-03-06 22:33:39 +00:00
|
|
|
|
2025-06-02 10:44:45 +00:00
|
|
|
RUN go install -a -installsuffix cgo std
|
2024-12-19 11:38:57 +00:00
|
|
|
|
2025-06-02 10:44:45 +00:00
|
|
|
COPY --link go.mod .
|
|
|
|
|
COPY --link go.sum .
|
|
|
|
|
COPY --link vendor/ vendor/
|
2025-04-22 14:40:16 +00:00
|
|
|
|
2025-06-02 10:44:45 +00:00
|
|
|
RUN go mod verify
|
2025-04-25 17:02:50 +00:00
|
|
|
|
2025-06-02 10:44:45 +00:00
|
|
|
COPY --link cmd/ cmd/
|
|
|
|
|
COPY --link api/ api/
|
|
|
|
|
COPY --link internal/ internal/
|
2025-04-25 17:02:50 +00:00
|
|
|
|
2024-12-19 11:38:57 +00:00
|
|
|
ARG TARGETARCH
|
|
|
|
|
|
2025-04-22 14:40:16 +00:00
|
|
|
ENV CGO_ENABLED=1
|
|
|
|
|
ENV GOARCH=${TARGETARCH}
|
|
|
|
|
ENV CC=musl-gcc
|
|
|
|
|
|
2025-06-02 10:44:45 +00:00
|
|
|
ARG GIT_VERSION=dev
|
|
|
|
|
ARG GIT_COMMIT=unknown
|
2025-09-18 21:06:21 +00:00
|
|
|
ARG BUILD_TIME=unknown
|
2025-06-02 10:44:45 +00:00
|
|
|
|
|
|
|
|
RUN go build \
|
|
|
|
|
-mod vendor \
|
|
|
|
|
-tags musl \
|
|
|
|
|
-trimpath \
|
|
|
|
|
-installsuffix cgo \
|
2025-09-18 21:06:21 +00:00
|
|
|
-ldflags "-s -w -linkmode external -extldflags '-static -Wl,--as-needed -Wl,--gc-sections -Wl,-O1' -X queryorchestration/internal/serviceconfig/build.version=${GIT_VERSION} -X queryorchestration/internal/serviceconfig/build.gitCommit=${GIT_COMMIT} -X queryorchestration/internal/serviceconfig/build.buildTime=${BUILD_TIME}" \
|
2025-06-02 10:44:45 +00:00
|
|
|
-o bin/ ./cmd/...
|
2024-12-19 11:38:57 +00:00
|
|
|
|
2025-01-10 11:12:03 +00:00
|
|
|
FROM scratch AS final
|
2024-12-19 11:38:57 +00:00
|
|
|
|
2025-01-31 13:43:55 +00:00
|
|
|
ENV PWD=/app
|
|
|
|
|
|
|
|
|
|
WORKDIR ${PWD}
|
2025-01-10 12:58:14 +00:00
|
|
|
|
2025-04-22 19:57:35 +00:00
|
|
|
COPY --from=build /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/
|
2025-05-08 16:04:45 +00:00
|
|
|
COPY --from=build /app/bin/ .
|
2025-02-13 15:44:08 +00:00
|
|
|
|
|
|
|
|
EXPOSE 8080
|
2025-06-09 23:30:06 +00:00
|
|
|
|
2025-10-13 22:13:15 +00:00
|
|
|
HEALTHCHECK --interval=30s --timeout=3s --start-period=60s --retries=10 \
|
2025-06-09 23:30:06 +00:00
|
|
|
CMD ["./healthcheck"]
|