run scripts test k6 with metrics exporter /metrcis
844
Dockerfile
FROM golang:1.18-alpine as builder
WORKDIR /app
ENV CGO_ENABLED 0
RUN go install go.k6.io/xk6/cmd/xk6@latest
RUN xk6 build --with github.com/szkiba/xk6-prometheus@latest
FROM alpine
COPY --from=builder /app/k6 /bin/
COPY ./script.js .
# ENTRYPOINT [ "k6", "run", "/script.js" ]
ENTRYPOINT [ "k6" ]
run k6 in docker image container with prometheus exporter
docker build -t k6 .
docker-compose up -d
docker exec -ti k6 sh
k6 run -d 1m --out prometheus script.js
http://127.0.0.1:5656/metrics
ref https://pkg.go.dev/github.com/jhzhu89/xk6-prometheus#section-readme
ref https://github.com/szkiba/xk6-prometheus
ref https://k6.io/docs/extensions/guides/build-a-k6-binary-with-extensions/
Content type
Image
Digest
sha256:255f0d9ce…
Size
12.7 MB
Last updated
over 3 years ago
docker pull akaronte/k6-prometheus