building new docker image based on K6’s official docker image to run across multiple CICD workflows.
FROM grafana/k6 # copy k6 test script COPY dist/test.js /app/ COPY dist/test.js.map /app/ # set working directory WORKDIR /app # Here need to run aws cli command to extract secrets from AWS SecretsManager and pass them via -e flags # CMD ["run", "test.js", "-e", "secret=MyBigSecret"]
However before running k6 script, need to extract secrets from AWS SecretsManager which is used inside of k6 test script.
I can extract secrets and pass them with
docker run command as env variables, but this requires to update more than 20 CICD workflows and expose those details, all I want to bake into single new docker image without exposing details.
or is it possible to create a node docker image and install K6 there?
Found this example, however it will throw error Error: Cannot find module ‘k6’
FROM node:14.7.0 #Install K6 WORKDIR /tmp ADD https://github.com/loadimpact/k6/releases/download/v0.27.1/k6-v0.27.1-linux64.tar.gz /tmp/k6-v0.27.1-linux64.tar.gz RUN tar -xzf k6-v0.27.1-linux64.tar.gz RUN mv k6-v0.27.1-linux64/k6 /usr/bin/k6 #Install NPM dependencies COPY loadtest-home /loadtest-home WORKDIR /loadtest-home RUN npm ci ENTRYPOINT node index.js