36 lines
665 B
Docker
36 lines
665 B
Docker
# Build k6 from source
|
|
FROM golang: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"]
|