Skip to content

Instantly share code, notes, and snippets.

@mplewis
Last active January 3, 2016 10:09
Show Gist options
  • Save mplewis/8447464 to your computer and use it in GitHub Desktop.
Save mplewis/8447464 to your computer and use it in GitHub Desktop.
How to deploy with GitHub, CI, and Docker, if you're into that

Stupid Docker Tricks

Create a docker group

sudo groupadd docker
sudo chgrp docker /var/run/docker.sock

This lets anyone in the docker group execute docker commands—much better than sudoing everything.

Build deploy scripts for each project

Use a deploy script to automatically:

  • Get the repo into working condition (checkout -f master, blasting any files in the way)
  • Pull changes from GitHub
  • Build an updated image
  • Kill the old container
  • Start the newly-pulled container

Use Hook to Deploy to deploy on CI pushes

Build a hook into config.js that runs the deploy script above when your CI system gives you the green checkmark.

Here's a sample config.js for Hook to Deploy.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment