You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
51 lines
1.1 KiB
51 lines
1.1 KiB
# Dockerfile for benchmark runner |
|
FROM golang:1.25-alpine AS builder |
|
|
|
# Install build dependencies |
|
RUN apk add --no-cache git ca-certificates |
|
|
|
# Set working directory |
|
WORKDIR /build |
|
|
|
# Copy go modules |
|
COPY go.mod go.sum ./ |
|
RUN go mod download |
|
|
|
# Copy source code |
|
COPY . . |
|
|
|
# Build the benchmark tool |
|
RUN CGO_ENABLED=0 GOOS=linux go build -a -installsuffix cgo -o benchmark cmd/benchmark/main.go |
|
|
|
# Final stage |
|
FROM alpine:latest |
|
|
|
# Install runtime dependencies |
|
RUN apk --no-cache add ca-certificates curl wget |
|
|
|
WORKDIR /app |
|
|
|
# Copy benchmark binary |
|
COPY --from=builder /build/benchmark /app/benchmark |
|
|
|
# Copy benchmark runner script |
|
COPY cmd/benchmark/benchmark-runner.sh /app/benchmark-runner |
|
|
|
# Make scripts executable |
|
RUN chmod +x /app/benchmark-runner |
|
|
|
# Create runtime user and reports directory owned by uid 1000 |
|
RUN adduser -u 1000 -D appuser && \ |
|
mkdir -p /reports && \ |
|
chown -R 1000:1000 /app /reports |
|
|
|
# Environment variables |
|
ENV BENCHMARK_EVENTS=10000 |
|
ENV BENCHMARK_WORKERS=8 |
|
ENV BENCHMARK_DURATION=60s |
|
|
|
# Drop privileges: run as uid 1000 |
|
USER 1000:1000 |
|
|
|
# Run the benchmark runner |
|
CMD ["/app/benchmark-runner"] |