mirror of
https://github.com/BookStackApp/BookStack.git
synced 2025-04-24 13:14:06 +08:00
Docker Support
This commit is contained in:
parent
45641d0754
commit
b97904e4bb
@ -64,4 +64,4 @@ MAIL_HOST=localhost
|
||||
MAIL_PORT=1025
|
||||
MAIL_USERNAME=null
|
||||
MAIL_PASSWORD=null
|
||||
MAIL_ENCRYPTION=null
|
||||
MAIL_ENCRYPTION=null
|
||||
|
5
.htaccess
Normal file
5
.htaccess
Normal file
@ -0,0 +1,5 @@
|
||||
Options +FollowSymLinks
|
||||
RewriteEngine On
|
||||
RewriteCond %{REQUEST_FILENAME} !-d
|
||||
RewriteCond %{REQUEST_FILENAME} !-f
|
||||
RewriteRule ^ index.php [L]
|
29
000-default.conf
Normal file
29
000-default.conf
Normal file
@ -0,0 +1,29 @@
|
||||
<VirtualHost *:80>
|
||||
# The ServerName directive sets the request scheme, hostname and port that
|
||||
# the server uses to identify itself. This is used when creating
|
||||
# redirection URLs. In the context of virtual hosts, the ServerName
|
||||
# specifies what hostname must appear in the request's Host: header to
|
||||
# match this virtual host. For the default virtual host (this file) this
|
||||
# value is not decisive as it is used as a last resort host regardless.
|
||||
# However, you must set it for any further virtual host explicitly.
|
||||
#ServerName www.example.com
|
||||
|
||||
ServerAdmin webmaster@localhost
|
||||
DocumentRoot /var/www/html/public
|
||||
|
||||
# Available loglevels: trace8, ..., trace1, debug, info, notice, warn,
|
||||
# error, crit, alert, emerg.
|
||||
# It is also possible to configure the loglevel for particular
|
||||
# modules, e.g.
|
||||
#LogLevel info ssl:warn
|
||||
|
||||
ErrorLog ${APACHE_LOG_DIR}/error.log
|
||||
CustomLog ${APACHE_LOG_DIR}/access.log combined
|
||||
|
||||
# For most configuration files from conf-available/, which are
|
||||
# enabled or disabled at a global level, it is possible to
|
||||
# include a line for only one particular virtual host. For example the
|
||||
# following line enables the CGI configuration for this host only
|
||||
# after it has been globally disabled with "a2disconf".
|
||||
#Include conf-available/serve-cgi-bin.conf
|
||||
</VirtualHost>
|
15
Dockerfile
Normal file
15
Dockerfile
Normal file
@ -0,0 +1,15 @@
|
||||
FROM php:5-apache
|
||||
MAINTAINER Dan Brown
|
||||
COPY . /var/www/html
|
||||
COPY docker-entrypoint.sh /var/www/html
|
||||
RUN apt-get update && \
|
||||
apt-get install git sed zlib1g-dev mysql-client -y && \
|
||||
curl -O https://getcomposer.org/installer && \
|
||||
php installer --install-dir=/usr/bin --filename=composer && \
|
||||
rm installer && chmod +x /var/www/html/docker-entrypoint.sh && \
|
||||
docker-php-ext-install pdo_mysql mbstring zip && cd /var/www/html && \
|
||||
composer install
|
||||
ENV DBNAME=bookstack
|
||||
WORKDIR /var/www/html
|
||||
EXPOSE 80
|
||||
CMD /var/www/html/docker-entrypoint.sh
|
19
docker-entrypoint.sh
Normal file
19
docker-entrypoint.sh
Normal file
@ -0,0 +1,19 @@
|
||||
#!/bin/bash
|
||||
if [ -f ./.env.example ]; then
|
||||
echo 'Creating config file...'
|
||||
mv ./.env.example ./.env
|
||||
sed -i s/DB_HOST=localhost/DB_HOST=$MYSQL_PORT_3306_TCP_ADDR/ .env
|
||||
sed -i s/DB_USERNAME=database_username/DB_USERNAME=root/ .env
|
||||
sed -i s/DB_DATABASE=database_database/DB_DATABASE=$DBNAME/ .env
|
||||
sed -i s/DB_PASSWORD=database_user_password/DB_PASSWORD=$MYSQL_ENV_MYSQL_ROOT_PASSWORD/ .env
|
||||
echo 'Install Dependencies...'
|
||||
php artisan key:generate
|
||||
echo 'Configuring web and database servers...'
|
||||
rm /etc/apache2/sites-available/000-default.conf && mv /var/www/html/000-default.conf /etc/apache2/sites-available && cd /etc/apache2/sites-enabled && ls -s /etc/apache2/sites-available/000-default.conf
|
||||
mysql -h $MYSQL_PORT_3306_TCP_ADDR -u root -p$MYSQL_ENV_MYSQL_ROOT_PASSWORD -e "CREATE DATABASE $DBNAME;"
|
||||
php artisan migrate --force
|
||||
a2enmod rewrite
|
||||
chown -R www-data:www-data /var/www/html
|
||||
fi
|
||||
|
||||
apache2-foreground
|
Loading…
x
Reference in New Issue
Block a user