Skip to content

Instantly share code, notes, and snippets.

@erikiado
erikiado / post-receive
Created May 10, 2017 23:47
post-receive hook for git with django and virtual envs
#!/bin/bash
while read oldrev newrev ref
do
if [[ $ref =~ .*/master$ ]]; # Only check for master
then
echo "Master ref received. Deploying master branch to production..."
git --work-tree=/home/thelma/jp2_online --git-dir=/home/thelma/jp2_online/.git checkout -f # Where is the project folder and where is the git repo initialized
. /home/thelma/.env/jp2_production/bin/activate # Activate virtual environment
pip install -r /home/thelma/jp2_online/requirements/production.txt # Install requirements
npm install --production # Install node requirements