Skip to content

Commit

Permalink
update(cli): remove docker build from deploy
Browse files Browse the repository at this point in the history
  • Loading branch information
scragg0x committed Sep 25, 2016
1 parent b8083b4 commit 9b445bd
Showing 1 changed file with 7 additions and 10 deletions.
17 changes: 7 additions & 10 deletions realms/commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
import sys
import os
import time
import subprocess
from subprocess import call, Popen
from multiprocessing import cpu_count

Expand Down Expand Up @@ -74,6 +73,7 @@ def prompt_and_invoke(ctx, fn):

ctx.invoke(fn, **kw)


@cli.command()
@click.option('--site-title',
default=config.SITE_TITLE,
Expand Down Expand Up @@ -295,7 +295,7 @@ def configure(json_string):
"""
try:
config.update(json.loads(json_string))
except ValueError, e:
except ValueError as e:
red('Config value should be valid JSON')


Expand Down Expand Up @@ -403,9 +403,10 @@ def create_db():
""" Creates DB tables
"""
green("Creating all tables")
with app.app_context():
green('DB_URI: %s' % app.config.get('DB_URI'))
db.metadata.create_all(db.get_engine(app))
if app.config.get('DB_URI'):
with app.app_context():
green('DB_URI: %s' % app.config.get('DB_URI'))
db.metadata.create_all(db.get_engine(app))


@cli.command()
Expand Down Expand Up @@ -449,13 +450,9 @@ def version():

@cli.command(add_help_option=False)
def deploy():
""" Deploy to PyPI and docker hub
""" Deploy to PyPI
"""
call("python setup.py sdist upload", shell=True)
call("sudo docker build --no-cache -t realms/realms-wiki %s/docker" % app.config['APP_PATH'], shell=True)
id_ = json.loads(Popen("sudo docker inspect realms/realms-wiki".split(), stdout=subprocess.PIPE).communicate()[0])[0]['Id']
call("sudo docker tag %s realms/realms-wiki:%s" % (id_, __version__), shell=True)
call("sudo docker push realms/realms-wiki", shell=True)

if __name__ == '__main__':
cli()

0 comments on commit 9b445bd

Please sign in to comment.