Skip to content

Commit 035f9eb

Browse files
committed
Ajout de la config dynamique avec un container MySQL
1 parent 6f8ef08 commit 035f9eb

File tree

5 files changed

+40
-59
lines changed

5 files changed

+40
-59
lines changed

Diff for: .env

-56
This file was deleted.

Diff for: .gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
.idea/

Diff for: Dockerfile

+9-3
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,16 @@
11
FROM php:5.6-apache
2-
RUN apt-get update && apt-get install -y git zlib1g-dev && docker-php-ext-install pdo pdo_mysql mbstring zip
2+
3+
RUN apt-get update && apt-get install -y git zlib1g-dev libfreetype6-dev libjpeg62-turbo-dev libmcrypt-dev libpng12-dev \
4+
&& docker-php-ext-install pdo pdo_mysql mbstring zip \
5+
&& docker-php-ext-configure gd --with-freetype-dir=usr/include/ --with-jpeg-dir=/usr/include/ \
6+
&& docker-php-ext-install gd
37
RUN cd ~ && curl -sS https://getcomposer.org/installer | php
48
RUN mv ~/composer.phar /usr/local/bin/composer
5-
RUN cd /var/www/ && git clone https://github.com/ssddanbrown/BookStack.git --branch release --single-branch BookStack
9+
RUN cd /var/www/ && git clone https://github.com/ssddanbrown/BookStack.git --branch 0.7.2 --single-branch BookStack
610
RUN cd /var/www/BookStack && composer install
7-
COPY .env /var/www/BookStack/.env
811
RUN chown -R www-data:www-data /var/www/BookStack
912
COPY bookstack.conf /etc/apache2/sites-enabled/bookstack.conf
1013
RUN a2enmod rewrite
14+
15+
COPY docker-entrypoint.sh /
16+
ENTRYPOINT ["/docker-entrypoint.sh"]

Diff for: README.md

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
# BookStack Docker image
2+
3+
## Usage with linked server
4+
5+
First you need to run MySQL server in Docker, and this image need link a running mysql instance container :
6+
```
7+
docker run --name my-bookstack -d --link bookstack-mysql:mysql -p 8080:80 ??/bookstack
8+
```
9+

Diff for: docker-entrypoint.sh

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
#!/bin/bash
2+
set -e
3+
4+
if [ ! -f '/var/www/BookStack/.env' ]; then
5+
cp /var/www/BookStack/.env.example /var/www/BookStack/.env
6+
7+
if [ "$MYSQL_PORT_3306_TCP" ]; then
8+
sed -i "s/\(DB_HOST *= *\).*/\1mysql/" '/var/www/BookStack/.env'
9+
sed -i "s/\(DB_DATABASE *= *\).*/\1${MYSQL_ENV_MYSQL_DATABASE:-root}/" '/var/www/BookStack/.env'
10+
sed -i "s/\(DB_USERNAME *= *\).*/\1${MYSQL_ENV_MYSQL_USER:-$MYSQL_ENV_MYSQL_ROOT_PASSWORD}/" '/var/www/BookStack/.env'
11+
sed -i "s/\(DB_PASSWORD *= *\).*/\1${MYSQL_ENV_MYSQL_PASSWORD:-bookstack}/" '/var/www/BookStack/.env'
12+
13+
cd /var/www/BookStack/ && php artisan key:generate && php artisan migrate --force
14+
else
15+
echo >&2 'warning: missing MYSQL_PORT_3306_TCP environment variables'
16+
echo >&2 ' Did you forget to --link some_mysql_container:mysql ?'
17+
exit 1
18+
fi
19+
fi
20+
21+
apache2-foreground

0 commit comments

Comments
 (0)