feat: k6 load testing web UI with Docker
- Multi-stage Dockerfile builds k6 from source (grafana/k6) - Express backend with SSE live output streaming - SQLite-backed test history with delete support - Frontend: URL input, VUs, duration, RPS limit, custom headers - Persisted via Docker volume, listens on port 8118 Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
35
Dockerfile
Normal file
35
Dockerfile
Normal file
@@ -0,0 +1,35 @@
|
||||
# Build k6 from source
|
||||
FROM golang:1.22-alpine AS k6-builder
|
||||
|
||||
RUN apk add --no-cache git
|
||||
|
||||
WORKDIR /src
|
||||
RUN git clone --depth=1 https://github.com/grafana/k6.git .
|
||||
RUN go build -o /usr/local/bin/k6 .
|
||||
|
||||
# Final image
|
||||
FROM node:20-alpine
|
||||
|
||||
# Copy k6 binary from builder
|
||||
COPY --from=k6-builder /usr/local/bin/k6 /usr/local/bin/k6
|
||||
|
||||
# Install backend dependencies
|
||||
WORKDIR /app/backend
|
||||
COPY backend/package.json .
|
||||
RUN npm install --production
|
||||
|
||||
COPY backend/server.js .
|
||||
|
||||
# Copy frontend
|
||||
COPY frontend/ /app/frontend/
|
||||
|
||||
# Data volume for SQLite history
|
||||
RUN mkdir -p /data
|
||||
VOLUME /data
|
||||
|
||||
ENV PORT=8118
|
||||
ENV DB_PATH=/data/history.db
|
||||
|
||||
EXPOSE 8118
|
||||
|
||||
CMD ["node", "/app/backend/server.js"]
|
||||
Reference in New Issue
Block a user