9a32cdb1b3
schemas / vulnerabilities (push) Successful in 1m56s
schemas / check (push) Successful in 2m46s
schemas / check-release (push) Successful in 2m53s
schemas / build (push) Successful in 6m4s
pre-commit / pre-commit (push) Successful in 6m51s
schemas / deploy-prod (push) Successful in 1m14s
Release / release (push) Successful in 1m4s
## Summary - Sets `NODE_OPTIONS=--max-old-space-size=64` in Dockerfile to cap Node.js heap when running `wgc router compose` - Prevents container OOMKills in memory-constrained environments (e.g. acctest with 128Mi limit) - The wgc Node.js process was using unbounded heap, which combined with the Go service easily exceeded container memory limits during rapid schema publishing 🤖 Generated with [Claude Code](https://claude.com/claude-code) Reviewed-on: #788
44 lines
1.5 KiB
Docker
44 lines
1.5 KiB
Docker
FROM amd64/golang:1.26.1@sha256:984bf90a420602a708a0e5b08d5660e2902daf7d26f0be3c5db5d07ced6dcce3 as modules
|
|
WORKDIR /build
|
|
ADD go.* /build
|
|
RUN go mod download
|
|
|
|
FROM modules as build
|
|
ARG CI_COMMIT
|
|
WORKDIR /build
|
|
ENV CGO_ENABLED=0
|
|
ADD . /build
|
|
RUN CGO_ENABLED=1 go test -mod=readonly -race -coverprofile=coverage.txt.tmp -covermode=atomic -coverpkg=$(go list ./... | tr '\n' , | sed 's/,$//') ./...
|
|
RUN ["/bin/bash", "-c", "cat coverage.txt.tmp | grep -v testing.go | grep -v -f <(find . -type f | xargs grep -l 'Code generated by github.com/99designs/gqlgen, DO NOT EDIT') > coverage.txt"]
|
|
RUN go tool cover -html=coverage.txt -o coverage.html
|
|
RUN go tool cover -func=coverage.txt
|
|
RUN rm coverage.txt.tmp
|
|
|
|
RUN GOOS=linux GOARCH=amd64 go build \
|
|
-a -installsuffix cgo \
|
|
-mod=readonly \
|
|
-o /release/service \
|
|
-ldflags "-w -s -X main.buildVersion=${CI_COMMIT}" \
|
|
./cmd/service/service.go
|
|
|
|
FROM scratch as export
|
|
COPY --from=build /build/coverage.txt /
|
|
|
|
FROM node:24.14.1-alpine@sha256:01743339035a5c3c11a373cd7c83aeab6ed1457b55da6a69e014a95ac4e4700b
|
|
ENV TZ Europe/Stockholm
|
|
|
|
# Install wgc CLI globally for Cosmo Router composition
|
|
RUN npm install -g wgc@latest
|
|
|
|
# Cap Node.js heap for runtime wgc invocations to prevent OOM
|
|
ENV NODE_OPTIONS="--max-old-space-size=64"
|
|
|
|
# Copy timezone data and certificates
|
|
COPY --from=build /usr/share/zoneinfo /usr/share/zoneinfo
|
|
COPY --from=build /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/
|
|
|
|
# Copy the service binary
|
|
COPY --from=build /release/service /
|
|
|
|
CMD ["/service"]
|