Added dev-docker.sh for developing with Docker

Developing using Docker is now simple and avoids the need to install PHP on the developer's host machine. Common code from `dev.sh` and `dev-docker.sh` has been extracted into a `dev-prepare.sh`. README contains instructions on how to use both dev scripts - which the developer can choose based on their preference.
This commit is contained in:
Fabrizio Lungo 2017-04-05 15:06:31 +01:00 committed by Alex Grintsvayg
parent d5b71a9e17
commit 2ec174b685
4 changed files with 25 additions and 4 deletions

View file

@ -9,7 +9,16 @@ It's very easy to have lbry.io running locally:
- Install PHP7
- Checkout the project
- Run `./dev.sh` from the project root
- Access `localhost:8000` in your browser
- Access [localhost:8000](http://localhost:8000) in your browser
You can also run the development server using docker:
- Install Docker
- Checkout the project
- Run `./dev-docker.sh` from the project root
- Access [localhost:8000](http://localhost:8000) in your browser
Both the `dev.sh` and `dev-docker.sh` scripts will initialise a configuration based on `data/config.php.example` if `data/config.php` does not exist.
To run remotely, simply install PHP and configure Apache or your server of choice to serve `web/index.php`.

11
dev-docker.sh Executable file
View file

@ -0,0 +1,11 @@
#!/bin/bash
source dev-prepare.sh
docker run --rm -it --name "dev.lbry.io" \
-v "$(readlink -f .):/usr/src/lbry.io" \
-w "/usr/src/lbry.io" \
-p "127.0.0.1:8000:8000" \
-u "$(id -u):$(id -g)" \
php:7-alpine \
php --server "0.0.0.0:8000" --docroot "web/" "web/index.php"

3
dev-prepare.sh Normal file
View file

@ -0,0 +1,3 @@
if [ ! -e "data/config.php" ]; then
cp "data/config.php.example" "data/config.php"
fi

4
dev.sh
View file

@ -1,7 +1,5 @@
#!/bin/bash
if [ ! -e "data/config.php" ]; then
cp "data/config.php.example" "data/config.php"
fi
source dev-prepare.sh
php7.0 --server localhost:8000 --docroot web/ web/index.php