Skip to content

Instantly share code, notes, and snippets.


phpdude/ Secret

Created Mar 3, 2016
What would you like to do?
# coding=utf-8
import os
from fabric.api import env
from fabric.context_managers import cd
from fabric.decorators import roles
from fabric.operations import run, local, put
env.roledefs['master'] = ['project@ip']
def _production_env():
# Speedup connection setup to server.
env.disable_known_hosts = True
env.key_filename = [os.path.join(os.environ['HOME'], '.ssh', 'id_rsa')]
env.project_root = '~/app/'
def build():
local('docker build -f production/Dockerfile -t phpdude/project:app .')
local('docker push phpdude/project:app')
def deploy():
with cd(env.project_root):
put('production/docker-compose.yml', '~/app/')
run('docker-compose pull')
run('docker-compose up -d')
def clear_cache():
with cd(env.project_root):
run('docker-compose exec --rm manage clear_cache')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment