Skip to content

Instantly share code, notes, and snippets.

@smailq
Last active November 3, 2016 16:08
Show Gist options
  • Save smailq/0e69669007ed32e329a0ceb2e5969f6d to your computer and use it in GitHub Desktop.
Save smailq/0e69669007ed32e329a0ceb2e5969f6d to your computer and use it in GitHub Desktop.
Build and run newly built image
#!/bin/bash
# Get current git sha
GIT_COMMIT=$(git rev-parse HEAD)
# Build docker image, then stop exisitng container, then run new container
make build; make stop; make run;
# Report to Slack about deployment
curl -s -X POST --data-urlencode 'payload={"channel": "#dev-ops", "username": "Staging Server", "text": "Commit '$GIT_COMMIT' has been pushed to http://some-project-home.com", "icon_emoji": ":floppy_disk:"}' https://hooks.slack.com/[slack-hook-url]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment