From 2a0c832a50fca3b3509d131d5901a30e2299bbc9 Mon Sep 17 00:00:00 2001 From: Mike Kaperys Date: Wed, 17 May 2017 21:58:56 +0100 Subject: [PATCH] Port to docker-compose --- container | 86 ------------------------------------------- doc/04-development.md | 10 ++--- docker-compose.yml | 9 +++++ 3 files changed, 13 insertions(+), 92 deletions(-) delete mode 100755 container create mode 100644 docker-compose.yml diff --git a/container b/container deleted file mode 100755 index 6f5c13b..0000000 --- a/container +++ /dev/null @@ -1,86 +0,0 @@ -#!/usr/bin/env bash - -# Config -command=${1} -containerName="financial" - -# [Local Path]:[Container Path] -mountPoints=( - "`pwd`:/var/cli/financial" -) - -function help() -{ - echo -e "\nUsage:" - echo -e "${0} [build|start|stop|restart|help|ssh|list]\n" - exit 1 -} - -function build() -{ - docker build -t ${containerName} . -} - -function start() -{ - mounts="" - for mountPoint in "${mountPoints[@]}"; do - mounts="${mounts} -v ${mountPoint} " - done - - docker run -d ${mounts} --name ${containerName} --hostname ${containerName} -t ${containerName} -} - -function stop() -{ - docker stop ${containerName} >/dev/null && docker rm ${containerName} >/dev/null -} - -function restart() -{ - stop - start -} - -function ssh() -{ - docker exec -it ${containerName} bash -} - -function list() -{ - docker ps -} - -case ${command} in - "build") - build - ;; - - "start") - start - ;; - - "stop") - stop - ;; - - "restart") - restart - ;; - - "help") - help - ;; - - "ssh") - ssh - ;; - - "list") - list - ;; - - *) - help -esac diff --git a/doc/04-development.md b/doc/04-development.md index 2a86e5b..b91a5b3 100644 --- a/doc/04-development.md +++ b/doc/04-development.md @@ -2,11 +2,9 @@ It is recommended to use the included Docker container when developing the library. It contains the required php extensions for running the example files and test suite. ## Using the container -Included in the root of the project is a `container` bash file. This is a basic wrapper for the included Docker container. You can use the `container` file to easily manager your Docker container. +You can use `docker-compose` to build and run the container. Simply run the following commands: -```bash -./container start -./container ssh -``` +- `docker-compose up` +- `docker-compose run financial` -The above will start the Docker instance and 'ssh' into the box. The mount point is `/src` locally, to `/var/cli/financial` on the container. +The above will start the Docker instance and 'ssh' into the box. The mount point is `./` locally, to `/var/cli/financial` in the container. diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..9f4f2bc --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,9 @@ +version: '3' + +services: + financial: + container_name: financial + hostname: financial + build: . + volumes: + - .:/var/cli/financial \ No newline at end of file