From: Dan Brown Date: Tue, 28 Mar 2023 15:00:34 +0000 (+0100) Subject: Added a docker environment for stable dev X-Git-Url: http://source.bookstackapp.com/system-cli/commitdiff_plain/264dd4c0af96253562296a008289aab78c5b46e2 Added a docker environment for stable dev --- diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..cd441d3 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,14 @@ +FROM ubuntu:22.04 + +# Install system depedancies +ARG DEBIAN_FRONTEND=noninteractive +RUN set -xe && \ + apt-get update -yqq && \ + apt-get install -yqq curl git mysql-client php8.1-cli php8.1-common php8.1-curl php8.1-mbstring \ + php8.1-xml php8.1-zip php8.1-gd php8.1-bcmath php8.1-mysql php8.1-xdebug + +# Install composer to a custom location +RUN mkdir /scripts && \ + curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer + +CMD ["/bin/bash"] \ No newline at end of file diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..a2054b5 --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,16 @@ +version: "3.8" + +services: + app: + build: . + volumes: + - ./:/cli + depends_on: + - db + db: + image: mysql:8.0 + environment: + MYSQL_ROOT_PASSWORD: password + MYSQL_DATABASE: bookstack + MYSQL_USER: bookstack + MYSQL_PASSWORD: bookstack \ No newline at end of file diff --git a/phpunit.xml b/phpunit.xml new file mode 100644 index 0000000..7b41a4f --- /dev/null +++ b/phpunit.xml @@ -0,0 +1,19 @@ + + + + + ./tests + + + + + ./app + + + + + + diff --git a/readme.md b/readme.md index 650a47f..186222f 100644 --- a/readme.md +++ b/readme.md @@ -8,7 +8,7 @@ A simple command line interface for managing instances of BookStack. Provides th - **Update** - Update an existing BookStack installation to the latest version. This CLI is intended to be platform abstract, intended for plain installs that follow our scripts/manual instructions. -This is intended to work independently from BookStack itself, so it can be used even if a BookStack instance is not available or broken, although it could be distributed with and called upon by the core BookStack codebase. +This is intended to work independently of BookStack itself, so it can be used even if a BookStack instance is not available or broken, although it could be distributed with and called upon by the core BookStack codebase. ### Development @@ -25,7 +25,24 @@ This can be done by running the compile file: php compile.php ``` +#### Docker Environment + +A docker-compose setup exists to create a clean, contained environment, which is important for this project since the +CLI checks and interacts with many system-level elements. + +```bash +# Enter the environment +docker compose run -w /cli app + +# From there you'll be dropped into a bash shell within the project directory. +# You could proceed to install dependencies via composer via: +composer install + +# Then you can run tests via: +vendor/bin/phpunit +``` + ### Contributing I welcome issues and PRs but keep in mind that I'd like to keep the feature-set narrow to limit support/maintenance burden. -Therefore I likely won't leave issues open long, or merge PRs, for requests to add new features or for changes that increase the scope of what this script already supports. \ No newline at end of file +Therefore, I likely won't leave issues open long, or merge PRs, for requests to add new features or for changes that increase the scope of what this script already supports. \ No newline at end of file