Loading Dockerfile 0 → 100644 +12 −0 Original line number Diff line number Diff line # docker Drupal # VERSION 0.3 FROM savoirfairelinux/lampd MAINTAINER Ernesto Rodriguez Ortiz <ernesto.rodriguezortiz@savoirfairelinuc.com> ENV initpath ./fabfile/docker COPY ${initpath} /opt/init RUN /opt/init/bootstrap ENTRYPOINT ["/opt/init/init"] CMD ["/sbin/my_init"] __init__.py +2 −2 Original line number Diff line number Diff line Loading @@ -21,10 +21,10 @@ def init(): execute(docker.container_start) execute(drush.make, 'install') execute(drush.site_install, host='root@{}'.format(env.container_ip)) execute(drush.site_install) execute(drush.aliases) execute(behat.init, host='root@{}'.format(env.container_ip)) execute(behat.init) @task Loading behat.py +0 −1 Original line number Diff line number Diff line Loading @@ -24,7 +24,6 @@ def init(rewrite=True): h.fab_run(role, 'cp example.behat.yml behat.yml') h.fab_run(role, 'sed -i "s@%DRUPAL_ROOT@{}@g" behat.yml'.format(site_root)) h.fab_run(role, 'sed -i "s@%URL@http://{}@g" behat.yml'.format(host)) h.fab_run(role, 'echo "127.0.0.1 {}" >> /etc/hosts'.format(host)) print green('Behat is now properly configured. The configuration file is {}/tests/behat/behat.yml'.format(workspace)) else: Loading docker.py +8 −3 Original line number Diff line number Diff line from __future__ import unicode_literals import os from fabric.api import task, roles, env, local, run, lcd, execute from fabric.colors import red, green from fabric.contrib.console import confirm Loading Loading @@ -54,6 +56,9 @@ def docker_tryrun(imgname, containername=None, opts='', mounts=None, cmd='', res else: containername_opt = '' opts += ' -e USER_ID={}'.format(os.getuid()) opts += ' -e GROUP_ID={}'.format(os.getgid()) local('docker run %s %s %s %s' % (opts, containername_opt, imgname, cmd)) return True Loading Loading @@ -114,7 +119,7 @@ def connect(): """ with lcd(env.workspace): if docker_isrunning('{}_container'.format(env.project_name)): local('docker exec -it {}_container bash'.format(env.project_name)) local('ssh drupalizer@{} -i {} -o StrictHostKeyChecking=no'.format(env.container_ip, h.fab_ssh_key())) else: print(red('Docker container {}_container is not running, it should be running to be able to connect.')) Loading @@ -129,8 +134,8 @@ def image_create(): if '{}/drupal'.format(env.project_name) in docker_images(): print(red('Docker image {}/drupal was found, you has already build this image'.format(env.project_name))) else: h.copy_public_ssh_keys('local') local('docker build -t {}/drupal .'.format(env.project_name)) dockerfile = h.fab_path('Dockerfile') local('docker build -t {}/drupal -f {} .'.format(env.project_name, dockerfile)) print(green('Docker image {}/drupal was build successful'.format(env.project_name))) Loading docker/bootstrap 0 → 100755 +12 −0 Original line number Diff line number Diff line #!/bin/bash set -e INIT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)/bootstrap.d" if [[ -d $INIT_DIR && -r $INIT_DIR && -x $INIT_DIR ]]; then for i in $(LC_ALL=C command ls "$INIT_DIR"); do i=$INIT_DIR/$i [[ -f $i && -r $i ]] && . "$i" done fi Loading
Dockerfile 0 → 100644 +12 −0 Original line number Diff line number Diff line # docker Drupal # VERSION 0.3 FROM savoirfairelinux/lampd MAINTAINER Ernesto Rodriguez Ortiz <ernesto.rodriguezortiz@savoirfairelinuc.com> ENV initpath ./fabfile/docker COPY ${initpath} /opt/init RUN /opt/init/bootstrap ENTRYPOINT ["/opt/init/init"] CMD ["/sbin/my_init"]
__init__.py +2 −2 Original line number Diff line number Diff line Loading @@ -21,10 +21,10 @@ def init(): execute(docker.container_start) execute(drush.make, 'install') execute(drush.site_install, host='root@{}'.format(env.container_ip)) execute(drush.site_install) execute(drush.aliases) execute(behat.init, host='root@{}'.format(env.container_ip)) execute(behat.init) @task Loading
behat.py +0 −1 Original line number Diff line number Diff line Loading @@ -24,7 +24,6 @@ def init(rewrite=True): h.fab_run(role, 'cp example.behat.yml behat.yml') h.fab_run(role, 'sed -i "s@%DRUPAL_ROOT@{}@g" behat.yml'.format(site_root)) h.fab_run(role, 'sed -i "s@%URL@http://{}@g" behat.yml'.format(host)) h.fab_run(role, 'echo "127.0.0.1 {}" >> /etc/hosts'.format(host)) print green('Behat is now properly configured. The configuration file is {}/tests/behat/behat.yml'.format(workspace)) else: Loading
docker.py +8 −3 Original line number Diff line number Diff line from __future__ import unicode_literals import os from fabric.api import task, roles, env, local, run, lcd, execute from fabric.colors import red, green from fabric.contrib.console import confirm Loading Loading @@ -54,6 +56,9 @@ def docker_tryrun(imgname, containername=None, opts='', mounts=None, cmd='', res else: containername_opt = '' opts += ' -e USER_ID={}'.format(os.getuid()) opts += ' -e GROUP_ID={}'.format(os.getgid()) local('docker run %s %s %s %s' % (opts, containername_opt, imgname, cmd)) return True Loading Loading @@ -114,7 +119,7 @@ def connect(): """ with lcd(env.workspace): if docker_isrunning('{}_container'.format(env.project_name)): local('docker exec -it {}_container bash'.format(env.project_name)) local('ssh drupalizer@{} -i {} -o StrictHostKeyChecking=no'.format(env.container_ip, h.fab_ssh_key())) else: print(red('Docker container {}_container is not running, it should be running to be able to connect.')) Loading @@ -129,8 +134,8 @@ def image_create(): if '{}/drupal'.format(env.project_name) in docker_images(): print(red('Docker image {}/drupal was found, you has already build this image'.format(env.project_name))) else: h.copy_public_ssh_keys('local') local('docker build -t {}/drupal .'.format(env.project_name)) dockerfile = h.fab_path('Dockerfile') local('docker build -t {}/drupal -f {} .'.format(env.project_name, dockerfile)) print(green('Docker image {}/drupal was build successful'.format(env.project_name))) Loading
docker/bootstrap 0 → 100755 +12 −0 Original line number Diff line number Diff line #!/bin/bash set -e INIT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)/bootstrap.d" if [[ -d $INIT_DIR && -r $INIT_DIR && -x $INIT_DIR ]]; then for i in $(LC_ALL=C command ls "$INIT_DIR"); do i=$INIT_DIR/$i [[ -f $i && -r $i ]] && . "$i" done fi