catchpoint / WebPageTest.tsproxy

Traffic-shaping SOCKS5 proxy
Apache License 2.0
73 stars 26 forks source link

Add Docker support #16

Closed pataquets closed 6 years ago

pataquets commented 6 years ago

Add Dockerfile to enable image building. Useful for development and tests under Docker workflow. Using the official Python image, pinned to 2.7 tag as per Readme. More info at https://hub.docker.com/_/python/

Just adding files, setting working dir and running build instructions. I've hardcoded --bind 0.0.0.0 option in the entrypoint, since tsproxy won't be reachable from outside the container, otherwise.

Build:

$ docker build -t tsproxy .

Run:

$ docker run --rm -it -p 1080:1080 tsproxy [tsproxy options]

FYI, there's a still quicker to test, already built image on my Docker Hub. Test it by running:

$ docker run --rm -it -p 1080:1080 pataquets/tsproxy [tsproxy options]

Using --rm causes the container to be deleted after stop.

Optional improvement to come (maybe in another issue):

pmeenan commented 6 years ago

Any chance you can also create a docker readme markdown file with the options for running it?

I already have a dockerhub org so adding tsproxy will be trivial - just want to have a doc to point it to as well.

pataquets commented 6 years ago

Done. Hope I've referenced the right org.

pmeenan commented 6 years ago

Thanks. Project is set up and builds have been kicked off: https://hub.docker.com/r/webpagetest/tsproxy/builds/

pataquets commented 6 years ago

Great! It should be possible to tweak the automatically generated image tags from the AB configuration settings to map 'tsproxy-1.0' git tags to '1.0' image tags by using some regexp, but I've not done it previously. Head to https://hub.docker.com/r/webpagetest/tsproxy/~/settings/automated-builds/ if interested.

Also I'm deleting my image on Docker Hub to avoid confusing users.

pataquets commented 6 years ago

@pmeenan: I've seen there has been a commit that successfully triggered its corresponding image build on DH. However, it's not tagged and it would be an ideal test to the 'tag built image from git tags' mapping I propose above. Currently, built image:tags look kinda redundant: docker pull webpagetest/tsproxy:tsproxy-1.0. I think it would be better to trim the tsproxy- git tag prefix when mapping into an image tag.

pmeenan commented 6 years ago

Looks like the regex is for selecting the tags to build and there is limited control for changing the name. The basic solution is to keep the release tags here simple and just tag it 1.0, 1.1, etc. I'll try tagging the latest as 1.1 and see how it goes.