Giter Site home page Giter Site logo

cms-builder-docker's Introduction

This provides a container for running cms-builder inside.

  1. Unless/until it gets rolled into the main cms-builder, you'll need this fork. Download it somewhere, uncomment the docker-compose.yml volumes line
    # - 'path/to/cms-builder/on/host:/opt/cms-builder
    
    and set the first path to the relative or absolute location of the custom cms-builder.
  2. Ensure the site project has the following snippet in its .platform-project.local.settings.php file.
    // Configuration when running drush commands from inside a docker container.
    if (getenv('CMS_BUILDER_DOCKER')) {
      $cmd = "docker inspect --format='{{.NetworkSettings.Networks.bridge.IPAddress}}' {{ container_name }}";
      $ip = trim(shell_exec($cmd));
    
      // Update the host and port if running inside a container.
      $databases['default']['default'] = array(
        'host' => $ip,
        'port' => '3306',
      ) + $databases['default']['default'];
    }
  3. Create a directory called test in this project root that is owned by 33:33 (sorry, I realise that's not uber-portable). It can be improved I suspect (:
  4. Supply environment variables by command line or in .env.
    • SSH_KEY_FILE: the path to a private key with access to the git repo; this should be a deployment key, not a personal one! chown to 33:33 and chmod to 600.
    • PROJECT_ROOT: The absolute path to the project root. It gets directly mapped into the container running cms-builder (lovely, I know). Files will be checked out directly into this folder.
    • REPO_URL: The URL for the project repository. Must be accessible within the container.
    • REPO_BRANCH: (optional) The repo branch to checkout.
    • CMS_BUILDER_SITE: (optional) The site argument to specify to cms-builder build.
    • CMS_BUILDER_USER: (optional) The user that will be running cms-builder; defaults to 33 (www-data on Debian and derivatives).
  5. In theory you can just run docker-compose up and the tests will run. It's untested. Alternatively if you need an interactive terminal you can run docker-compose run -u www-data php run-tests or just do things manually by running docker-compose run -u www-data php /bin/bash.
# Quickstart (uses sudo)
git clone XXX
cd cms-builder-docker
mkdir test
sudo chown 33:33 test
cat << ENV > .env
SSH_KEY_FILE={{path to deployment private key}}
CMS_BUILDER_PROJECT_ROOT={{path to project root}}
CMS_BUILDER_SITE={{site to build}}
REPO_URL={{repo url}
REPO_BRANCH={{branch}}
ENV
docker-compose run -u www-data php run-tests

cms-builder-docker's People

Contributors

andriokha avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.