From d8231b174c31be86853e71a5c86eb2d096b33028 Mon Sep 17 00:00:00 2001
From: jurgenhaas <juergen@paragon-es.de>
Date: Wed, 19 Dec 2018 15:37:17 +0100
Subject: [PATCH] Provide quick start script and documentation

---
 Dockerfile |  5 +++--
 README.md  | 61 ++++++++++++++++++++++++++++++++++++------------------
 l3d        | 22 ++++++++++++++++++++
 3 files changed, 66 insertions(+), 22 deletions(-)
 create mode 100755 l3d

diff --git a/Dockerfile b/Dockerfile
index 6790c55..92a2aa3 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -1,13 +1,14 @@
 ARG PHP_VERSION
 
-FROM registry.lakedrops.com/docker/gitlab-drupal-ci:php-$PHP_VERSION
+FROM registry.lakedrops.com/docker/gitlab-drupal-ci:php-${PHP_VERSION}
 
 LABEL com.example.vendor="LakeDrops" \
       maintainer="juergen.haas@lakedrops.com" \
-      version="1.1.0" \
+      version="1.2.0" \
       description="Drupal development environment from LakeDrops."
 
 ENV LAKEDROPS_DEV_ENV 1
+ENV LAKEDROPS_DEV_DC_OPTIONS " "
 
 RUN echo "Install dorgflow" && \
     cd /var/opt && \
diff --git a/README.md b/README.md
index 5d94141..5c3ec90 100644
--- a/README.md
+++ b/README.md
@@ -1,32 +1,53 @@
 # LakeDropsDrupalDev - L3D
 
-## Setup
+Provides fully configured Docker images for local Drupal development where your local host requires nothing else than Docker being installed but no PHP, Composer or any other tool on this planet. It simply works.
 
-First of all we need to know the major PHP version you're using for a project. You should create a file called `.env` in the root of your project and add a line like this:
+## Prerequisites
 
-```
-PHP_VERSION=7.2
-```
+Nothing else than docker and this [script](https://gitlab.lakedrops.com/docker/l3d/raw/master/l3d) being installed on your host. You don't need any other tool - none!
 
-Supported versions are `7.0`, `7.1` and `7.2`.
+Ideally you download that script and copy that to a directory in your search path (e.g. `/usr/local/bin`), then it will be available for all your Drupal projects.
 
-### Install and update
+## Quick start
 
-```
-export $(cat .env | xargs) && docker pull registry.lakedrops.com/docker/l3d:php-${PHP_VERSION}
-```
+Go to the project root for which you want to use **L3D** and execute the downloaded script (simply type `l3d` at the command prompt). It will ask you for the PHP version to be used (input `7.0`, `7.1` or `7.2`) and it will download the matching L3D image and start a container for you.
 
-### Start from the root of your project
+## Usage
 
-```
-export $(cat .env | xargs) && docker run -it -v /var/run/docker.sock:/var/run/docker.sock -v ${PWD}:/drupal -v $SSH_AUTH_SOCK:/ssh-agent -v ${HOME}/.traefik:/root/.traefik -e SSH_AUTH_SOCK=/ssh-agent -w /drupal registry.lakedrops.com/docker/l3d:php-${PHP_VERSION} /usr/bin/fish
-```
+Inside the container you'll find the directory `/drupal` which contains everything from your project's root. You can work from there by using these available tools:
 
-Instead of the shell `/usr/bin/shell` you could also use `/bin/sh` or `/bin/bash`.
+| Tool | Command | Shortcut |
+| --- | --- | --- |
+| Ahoy | `ahoy` | `a` |
+| Composer | `composer` | `c` |
+| Docker | `docker` | |
+| Docker Composer | `docker-compose` | `d-c` |
+| DorgFlow | `dorgflow` | |
+| Drush | `drush` | `d` |
 
-## Usage
+## Update the image
 
-- Ahoy: shortcut `a`
-- Composer: shortcut `c`
-- Docker Composer: shortcut `d-c`
-- Drush: shortcut `d`
+When starting **L3D** with the script this will simply re-use the latest available image in your local docker environment. To force your docker to download the latest version of an image you can use `l3d -u` which will also start the working container for you but check for an updated version of the image first.
+
+## Examples
+
+### Start a new project
+
+```bash
+cd /var/www
+mkdir testproject1
+cd testproject1
+l3d
+wget https://gitlab.lakedrops.com/composer/project/drupal-8/raw/master/.gitignore
+wget https://gitlab.lakedrops.com/composer/project/drupal-8/raw/master/composer.json
+composer create-project --no-interaction
+ahoy d4d up
+```
+
+### Use with an existing project
+
+```bash
+cd /path/to/your/project
+l3d
+composer update
+```
diff --git a/l3d b/l3d
new file mode 100755
index 0000000..3fb8ed7
--- /dev/null
+++ b/l3d
@@ -0,0 +1,22 @@
+#!/usr/bin/env bash
+
+export $(cat .env | xargs)
+if [[ "${PHP_VERSION}" == "" ]]; then
+  while true; do
+      read -p "Which PHP version is your project using? " PHP_VERSION
+      case ${PHP_VERSION} in
+          7.0 ) break;;
+          7.1 ) break;;
+          7.2 ) break;;
+
+          * ) echo "Version not supported.";;
+      esac
+  done
+  echo "PHP_VERSION=${PHP_VERSION}" >>.env
+fi
+
+if [[ "$1" == "-u" ]]; then
+  docker pull registry.lakedrops.com/docker/l3d:php-${PHP_VERSION}
+fi
+
+docker run -it -v /var/run/docker.sock:/var/run/docker.sock -v ${PWD}:/drupal -v ${SSH_AUTH_SOCK}:/ssh-agent -v ${HOME}/.traefik:/root/.traefik -e SSH_AUTH_SOCK=/ssh-agent -w /drupal registry.lakedrops.com/docker/l3d:php-${PHP_VERSION} /usr/bin/fish
-- 
GitLab