Updated dev-docker setup to not alter phpunit.xml

Tested on my machine via fresh dev instance with tests passing.
May need old users to drop their old volume data.
This commit is contained in:
Dan Brown 2021-03-21 17:42:10 +00:00
parent 371033a0f2
commit 43c2fc3c37
5 changed files with 22 additions and 10 deletions

View File

@ -81,7 +81,7 @@ return [
'mysql_testing' => [
'driver' => 'mysql',
'url' => env('TEST_DATABASE_URL'),
'host' => $mysql_host,
'host' => '127.0.0.1',
'database' => 'bookstack-test',
'username' => env('MYSQL_USER', 'bookstack-test'),
'password' => env('MYSQL_PASSWORD', 'bookstack-test'),

View File

@ -3,14 +3,21 @@ FROM php:7.4-apache
ENV APACHE_DOCUMENT_ROOT /app/public
WORKDIR /app
# Install additional dependacnies and configure apache
RUN apt-get update -y \
&& apt-get install -y git zip unzip libpng-dev libldap2-dev wait-for-it \
&& docker-php-ext-configure ldap --with-libdir=lib/x86_64-linux-gnu \
&& docker-php-ext-install pdo_mysql gd ldap \
&& a2enmod rewrite \
&& sed -ri -e 's!/var/www/html!${APACHE_DOCUMENT_ROOT}!g' /etc/apache2/sites-available/*.conf \
&& sed -ri -e 's!/var/www/!${APACHE_DOCUMENT_ROOT}!g' /etc/apache2/apache2.conf /etc/apache2/conf-available/*.conf \
&& php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');" \
&& sed -ri -e 's!/var/www/!${APACHE_DOCUMENT_ROOT}!g' /etc/apache2/apache2.conf /etc/apache2/conf-available/*.conf
# Install composer
RUN php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');" \
&& php composer-setup.php \
&& mv composer.phar /usr/bin/composer \
&& php -r "unlink('composer-setup.php');"
# Use the default production configuration and update it as required
RUN mv "$PHP_INI_DIR/php.ini-production" "$PHP_INI_DIR/php.ini" \
&& sed -i 's/memory_limit = 128M/memory_limit = 512M/g' "$PHP_INI_DIR/php.ini"

View File

@ -10,7 +10,6 @@ else
composer install
wait-for-it db:3306 -t 45
php artisan migrate --database=mysql
php artisan migrate --database=mysql_testing
chown -R www-data:www-data storage
exec apache2-foreground
fi

View File

@ -23,12 +23,14 @@ services:
context: .
dockerfile: ./dev/docker/Dockerfile
environment:
APP_URL: http://localhost:${DEV_PORT:-8080}
DB_CONNECTION: mysql
DB_HOST: db
DB_PORT: 3306
DB_DATABASE: bookstack-dev
DB_USERNAME: bookstack-test
DB_PASSWORD: bookstack-test
TEST_DATABASE_URL: mysql://bookstack-test:bookstack-test@db/bookstack-test
MAIL_DRIVER: smtp
MAIL_HOST: mailhog
MAIL_PORT: 1025

View File

@ -102,7 +102,7 @@ If all the conditions are met, you can proceed with the following steps:
If needed, You'll be able to run any artisan commands via docker-compose like so:
```shell script
```bash
docker-compose run app php artisan list
```
@ -110,16 +110,20 @@ The docker-compose setup runs an instance of [MailHog](https://github.com/mailho
#### Running tests
After starting the general development Docker, seed the testing database:
```shell script
# this is to be done only once
After starting the general development Docker, migrate & seed the testing database:
```bash
# This only needs to be done once
docker-compose run app php artisan migrate --database=mysql_testing
docker-compose run app php artisan db:seed --class=DummyContentSeeder --database=mysql_testing
```
Once the database has been seeded, you can run the tests by:
```shell script
Once the database has been migrated & seeded, you can run the tests like so:
```bash
docker-compose run app php vendor/bin/phpunit
```
## 🌎 Translations
Translations for text within BookStack is managed through the [BookStack project on Crowdin](https://crowdin.com/project/bookstack). Some strings have colon-prefixed variables in such as `:userName`. Leave these values as they are as they will be replaced at run-time. Crowdin is the preferred way to provide translations, otherwise the raw translations files can be found within the `resources/lang` path.