-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
45 lines (32 loc) · 1.27 KB
/
Dockerfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
#FROM golang:1.18-alpine as builder
FROM ubuntu:22.04 as builder
ARG DEBIAN_FRONTEND=noninteractive
#WORKDIR $GOPATH/src/go.k6.io/k6
RUN apt-get update -y;
RUN apt-get install wget -y
RUN apt-get update -y && \
apt-get install chromium-browser -y
# Install golang
RUN wget https://go.dev/dl/go1.23.2.linux-amd64.tar.gz
RUN rm -rf /usr/local/go && tar -C /usr/local -xzf go1.23.2.linux-amd64.tar.gz; rm go1.23.2.linux-amd64.tar.gz
ENV PATH="/usr/local/go/bin:${PATH}"
# Install xk6
RUN /usr/local/go/bin/go install go.k6.io/xk6/cmd/xk6@latest
## build k6 with browser extension
## install K6 browser
RUN /root/go/bin/xk6 build latest --output /root/go/bin/k6 --with github.com/grafana/xk6-browser@latest
RUN apt-get update && \
apt-get install -y ca-certificates curl && \
rm -rf /var/lib/apt/lists/*
FROM alpine:3.15
RUN apk add --no-cache ca-certificates
COPY --from=builder /root/go/bin/k6 /usr/bin/k6
COPY --from=builder /usr/bin/chromium-browser /usr/bin/chromium-browser
COPY --from=builder /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/ca-certificates.crt
ADD start.sh .
RUN chmod +x start.sh
ENV RUN_IN_CONTAINER=true
ENV AWS_REGION=eu-south-1
ENV CHROME_BIN=/usr/bin/chromium-browser \
CHROME_PATH=/usr/lib/chromium/
ENTRYPOINT [ "/bin/sh", "start.sh" ]