7638fd3a90
Implement global and per ip rate limiting * all tests passing * test fix * Enhances test environment for rate limiting Updates the test environment to better support rate limiting tests. - Increases rate limits in test container to avoid interference with legitimate test traffic. - Increases the polling interval for client status checks to reduce load on the rate limiter. - Adds logic to retry status checks if rate limiting is encountered. * Merge branch 'main' of bitbucket.org:aarete/query-orchestration into feature/rate-limiting * build fix * test fix
59 lines
1.3 KiB
Docker
59 lines
1.3 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
|
|
ARG BUILD_TIME=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 queryorchestration/internal/serviceconfig/build.version=${GIT_VERSION} -X queryorchestration/internal/serviceconfig/build.gitCommit=${GIT_COMMIT} -X queryorchestration/internal/serviceconfig/build.buildTime=${BUILD_TIME}" \
|
|
-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=30s --timeout=3s --start-period=60s --retries=10 \
|
|
CMD ["./healthcheck"]
|