Commit 79f1e301 authored by Philippe Mouchel's avatar Philippe Mouchel
Browse files

Merge branch 'feature/dockerfile-initializer' into '2.x'

Dockerfile initializer in Drupalizer



See merge request !34
parents 9c1cb39d 1e8b730b
Loading
Loading
Loading
Loading
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"]
+2 −2
Original line number Diff line number Diff line
@@ -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
+0 −1
Original line number Diff line number Diff line
@@ -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:
+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
@@ -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

@@ -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.'))

@@ -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)))


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