def webbuild(self, reg='127.0.0.1:5000'): Webprod = tasks.ImageBuildDockerTasks( service=docker.Container( name='base', image='app', ), roles=['web'], registry=reg, build_path='/home/ladmin/workspace_cpp/fabrica/nginx', ) return Webprod
def phpfpm(self, reg='127.0.0.1:5000'): PhpFpm = tasks.ImageBuildDockerTasks( service=docker.Container( name='phpfpm', image='fpm', options={ 'publish': ['9000:9000'], 'link': ['fpm'], }, ), registry=reg, build_path='/home/ladmin/workspace_cpp/fabrica/php-fpm', roles=['phpfpm'], ) return PhpFpm
from fabricio import tasks, docker from fabricio.misc import AvailableVagrantHosts all_hosts = AvailableVagrantHosts(guest_network_interface='eth1') # all_hosts = ['127.0.0.1'] * 3 custom = tasks.ImageBuildDockerTasks( service=docker.Container( name='custom', image='nginx', options={ # 'publish': '80:80', }, ), hosts=all_hosts[:1], account='renskiy', # !! change this to your hub.docker.com account name !! )
from fabricio import tasks from fabricio.apps.python.django import DjangoContainer from fabricio.misc import AvailableVagrantHosts django = tasks.ImageBuildDockerTasks( service=DjangoContainer( name='django', image='django', options={ 'publish': '8000:8000', 'stop-signal': 'INT', 'volume': '/data/django:/data', 'env': 'DJANGO_SETTINGS_MODULE=settings', }, ), hosts=AvailableVagrantHosts(), registry='localhost:5000', ssh_tunnel_port=5000, )
from fabricio import tasks from fabricio.apps.python.django import DjangoContainer from fabricio.misc import AvailableVagrantHosts django = tasks.ImageBuildDockerTasks( service=DjangoContainer( name='django', image='django', options={ # `docker run` options 'stop-signal': 'INT', 'volume': '/data/django:/data', 'env': 'DJANGO_SETTINGS_MODULE=settings', }, ), registry='localhost:5000', ssh_tunnel='5000:5000', hosts=AvailableVagrantHosts(), rollback_command=True, # show `rollback` command in the list # migrate_commands=True, # show `migrate` and `migrate-back` commands in the list # backup_commands=True, # show `backup` and `restore` commands in the list # pull_command=True, # show `pull` command in the list # update_command=True, # show `update` command in the list # revert_command=True, # show `revert` command in the list # destroy_command=True, # show `destroy` command in the list prepare_command=True, # show `prepare` command in the list push_command=True, # show `push` command in the list upgrade_command=True, # show `upgrade` command in the list )
from fabric import api from fabricio import docker, tasks host = '195.201.27.44' @api.hosts(f'root@{host}') @api.task def create_docker_network(): api.run( 'docker network create --subnet 172.20.0.0/24 --gateway 172.20.0.1 teeworlds', ) teeworlds = tasks.ImageBuildDockerTasks( service=docker.Container( name='teeworlds', image='teeworlds', options=dict( network='teeworlds', ip='172.20.0.2', publish='8303:8303/udp', ), ), ssh_tunnel='5000:5000', registry='localhost:5000', hosts=[f'root@{host}'], build_path='teeworlds', )