joeyespo / grip

Preview GitHub README.md files locally before committing them.
MIT License
6.42k stars 423 forks source link

Add Docker support #317

Open pataquets opened 4 years ago

pataquets commented 4 years ago

Thank you very much for this awesome piece of software. As I've started to tinker with it, I'd like to share the Dockerfile which enabled a Docker workflow for me.

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

Just adding files, setting working dir and running install and build instructions. requirements.txt is added and pip install'ed in a separate step to speed up rebuilds, since it will take advantage of Docker image build layer caching on subsequent builds after modifying code.

Build:

$ docker build -t grip .

Build (no checkout needed):

$ docker build -t grip https://github.com/pataquets/grip#add-docker-support.

Run:

$ docker run --rm -it -v ${PWD}:/grip/ -p 6419:6419 grip [options...] /grip/ 0.0.0.0

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

$ docker run --rm -it -v ${PWD}:/grip/ -p 6419:6419 pataquets/grip-src [options...] /grip/ 0.0.0.0

The examples mount the current dir inside the Docker container (-v) and map container's internal port to outside host (p). Adding 0.0.0.0 is required, since otherwise container's localhost would not be reachable from outside (the host). Using --rm causes container it to be deleted after stop and -it makes the container not to go background and run interactively. Stop by CTRL+C'ing.

Optional improvement to come (maybe in another issue):

pataquets commented 3 years ago

@joeyespo ping

pataquets commented 1 year ago

@joeyespo Is grip still maintained? I have also a few changes lying around and would like to send them in return, too. No obligation, thou. In case you're no longer interested, you might find this useful: https://adoptoposs.org/ In any case, thanks for sharing this useful software!