Ajout de la config dynamique avec un container MySQL
This commit is contained in:
parent
6f8ef080d8
commit
035f9ebe9b
5 changed files with 40 additions and 59 deletions
56
.env
56
.env
|
@ -1,56 +0,0 @@
|
|||
# Environment
|
||||
APP_ENV=production
|
||||
APP_DEBUG=false
|
||||
APP_KEY=SomeRandomString
|
||||
|
||||
# Database details
|
||||
DB_HOST=192.168.99.100
|
||||
DB_DATABASE=bookstack
|
||||
DB_USERNAME=bookstack
|
||||
DB_PASSWORD=admin
|
||||
|
||||
# Cache and session
|
||||
CACHE_DRIVER=file
|
||||
SESSION_DRIVER=file
|
||||
QUEUE_DRIVER=sync
|
||||
|
||||
# Storage
|
||||
STORAGE_TYPE=local
|
||||
# Amazon S3 Config
|
||||
STORAGE_S3_KEY=false
|
||||
STORAGE_S3_SECRET=false
|
||||
STORAGE_S3_REGION=false
|
||||
STORAGE_S3_BUCKET=false
|
||||
# Storage URL
|
||||
# Used to prefix image urls for when using custom domains/cdns
|
||||
STORAGE_URL=false
|
||||
|
||||
# General auth
|
||||
AUTH_METHOD=standard
|
||||
|
||||
# Social Authentication information. Defaults as off.
|
||||
GITHUB_APP_ID=false
|
||||
GITHUB_APP_SECRET=false
|
||||
GOOGLE_APP_ID=false
|
||||
GOOGLE_APP_SECRET=false
|
||||
# URL used for social login redirects, NO TRAILING SLASH
|
||||
APP_URL=http://bookstack.dev
|
||||
|
||||
# External services such as Gravatar
|
||||
DISABLE_EXTERNAL_SERVICES=false
|
||||
|
||||
# LDAP Settings
|
||||
LDAP_SERVER=false
|
||||
LDAP_BASE_DN=false
|
||||
LDAP_DN=false
|
||||
LDAP_PASS=false
|
||||
LDAP_USER_FILTER=false
|
||||
LDAP_VERSION=false
|
||||
|
||||
# Mail settings
|
||||
MAIL_DRIVER=smtp
|
||||
MAIL_HOST=localhost
|
||||
MAIL_PORT=1025
|
||||
MAIL_USERNAME=null
|
||||
MAIL_PASSWORD=null
|
||||
MAIL_ENCRYPTION=null
|
1
.gitignore
vendored
Normal file
1
.gitignore
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
.idea/
|
12
Dockerfile
12
Dockerfile
|
@ -1,10 +1,16 @@
|
|||
FROM php:5.6-apache
|
||||
RUN apt-get update && apt-get install -y git zlib1g-dev && docker-php-ext-install pdo pdo_mysql mbstring zip
|
||||
MAINTAINER kilhog@protonmail.com
|
||||
RUN apt-get update && apt-get install -y git zlib1g-dev libfreetype6-dev libjpeg62-turbo-dev libmcrypt-dev libpng12-dev \
|
||||
&& docker-php-ext-install pdo pdo_mysql mbstring zip \
|
||||
&& docker-php-ext-configure gd --with-freetype-dir=usr/include/ --with-jpeg-dir=/usr/include/ \
|
||||
&& docker-php-ext-install gd
|
||||
RUN cd ~ && curl -sS https://getcomposer.org/installer | php
|
||||
RUN mv ~/composer.phar /usr/local/bin/composer
|
||||
RUN cd /var/www/ && git clone https://github.com/ssddanbrown/BookStack.git --branch release --single-branch BookStack
|
||||
RUN cd /var/www/ && git clone https://github.com/ssddanbrown/BookStack.git --branch 0.7.2 --single-branch BookStack
|
||||
RUN cd /var/www/BookStack && composer install
|
||||
COPY .env /var/www/BookStack/.env
|
||||
RUN chown -R www-data:www-data /var/www/BookStack
|
||||
COPY bookstack.conf /etc/apache2/sites-enabled/bookstack.conf
|
||||
RUN a2enmod rewrite
|
||||
|
||||
COPY docker-entrypoint.sh /
|
||||
ENTRYPOINT ["/docker-entrypoint.sh"]
|
9
README.md
Normal file
9
README.md
Normal file
|
@ -0,0 +1,9 @@
|
|||
# BookStack Docker image
|
||||
|
||||
## Usage with linked server
|
||||
|
||||
First you need to run MySQL server in Docker, and this image need link a running mysql instance container :
|
||||
```
|
||||
docker run --name my-bookstack -d --link bookstack-mysql:mysql -p 8080:80 ??/bookstack
|
||||
```
|
||||
|
21
docker-entrypoint.sh
Executable file
21
docker-entrypoint.sh
Executable file
|
@ -0,0 +1,21 @@
|
|||
#!/bin/bash
|
||||
set -e
|
||||
|
||||
if [ ! -f '/var/www/BookStack/.env' ]; then
|
||||
cp /var/www/BookStack/.env.example /var/www/BookStack/.env
|
||||
|
||||
if [ "$MYSQL_PORT_3306_TCP" ]; then
|
||||
sed -i "s/\(DB_HOST *= *\).*/\1mysql/" '/var/www/BookStack/.env'
|
||||
sed -i "s/\(DB_DATABASE *= *\).*/\1${MYSQL_ENV_MYSQL_DATABASE:-root}/" '/var/www/BookStack/.env'
|
||||
sed -i "s/\(DB_USERNAME *= *\).*/\1${MYSQL_ENV_MYSQL_USER:-$MYSQL_ENV_MYSQL_ROOT_PASSWORD}/" '/var/www/BookStack/.env'
|
||||
sed -i "s/\(DB_PASSWORD *= *\).*/\1${MYSQL_ENV_MYSQL_PASSWORD:-bookstack}/" '/var/www/BookStack/.env'
|
||||
|
||||
cd /var/www/BookStack/ && php artisan key:generate && php artisan migrate --force
|
||||
else
|
||||
echo >&2 'warning: missing MYSQL_PORT_3306_TCP environment variables'
|
||||
echo >&2 ' Did you forget to --link some_mysql_container:mysql ?'
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
|
||||
apache2-foreground
|
Loading…
Add table
Add a link
Reference in a new issue