Skip to content

Instantly share code, notes, and snippets.

@polarnik
Created December 28, 2022 09:02
Show Gist options
  • Save polarnik/1fe2d06e83158ca5d33bb2a2c67f9fec to your computer and use it in GitHub Desktop.
Save polarnik/1fe2d06e83158ca5d33bb2a2c67f9fec to your computer and use it in GitHub Desktop.
version: '3.0'
services:
mitmproxy:
image: mitmproxy/mitmproxy:9.0.1
hostname: mitmproxy
container_name: mitmproxy_run
restart: "no"
volumes:
- "./build/mitmproxy:/tmp/results"
- "./mitmproxy/har_dump.py:/har_dump.py:ro"
# https://github.com/mitmproxy/mitmproxy/blob/main/examples/contrib/har_dump.py
command: "/usr/local/bin/mitmdump
-s /har_dump.py
--set hardump=/tmp/results/dump.har
"
#!/usr/bin/env bash
echo "**** Stop prev proxy"
docker stop mitmproxy_run
docker rm mitmproxy_run
docker-compose -f ./mitmproxy.yaml rm --force --stop -v
echo "**** Start new proxy"
docker-compose -f ./mitmproxy.yaml run -d --rm --name mitmproxy_run mitmproxy
echo "**** Start test"
no_proxy="-e NO_PROXY=raw.githubusercontent.com,jslib.k6.io"
proxy_setting="-e HTTP_PROXY=mitmproxy:8080 -e HTTPS_PROXY=mitmproxy:8080"
docker-compose -f ./k6-tests.yaml run --rm $proxy_setting $no_proxy k6_tests
echo "**** Logs of proxy"
docker logs mitmproxy_run
echo "**** Stop proxy"
docker stop mitmproxy_run
docker-compose -f ./mitmproxy.yaml down
docker-compose -f ./mitmproxy.yaml rm --force --stop -v
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment