Add the ability to install extensions
This commit is contained in:
parent
0e451f0cdd
commit
9fa7b63665
18
Dockerfile
18
Dockerfile
@ -1,14 +1,3 @@
|
||||
FROM php:cli AS build
|
||||
|
||||
WORKDIR /flarum/app
|
||||
|
||||
RUN apt-get update && apt-get install -y git zip unzip p7zip
|
||||
RUN cd /tmp \
|
||||
&& curl --progress-bar http://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer \
|
||||
&& chmod +x /usr/local/bin/composer
|
||||
RUN composer create-project flarum/flarum /flarum/app
|
||||
|
||||
|
||||
FROM php:apache
|
||||
|
||||
WORKDIR /flarum/app
|
||||
@ -20,8 +9,9 @@ RUN sed -ri -e 's!AllowOverride [Nn]one!AllowOverride All!' /etc/apache2/sites-a
|
||||
RUN mv "$PHP_INI_DIR/php.ini-production" "$PHP_INI_DIR/php.ini"
|
||||
RUN a2enmod rewrite
|
||||
|
||||
COPY --from=composer /usr/bin/composer /usr/local/bin/composer
|
||||
RUN apt-get update \
|
||||
&& apt-get install -y gettext libfreetype-dev libjpeg62-turbo-dev libpng-dev libpq5 libpq-dev mariadb-client libyaml-0-2 libyaml-dev \
|
||||
&& apt-get install -y gettext git libfreetype-dev libjpeg62-turbo-dev libpng-dev libpq5 libpq-dev mariadb-client libyaml-0-2 libyaml-dev p7zip unzip zip \
|
||||
&& pecl install yaml \
|
||||
&& docker-php-ext-configure gd --with-freetype --with-jpeg \
|
||||
&& docker-php-ext-configure pgsql --with-pgsql=/usr/local/pgsql \
|
||||
@ -32,9 +22,9 @@ RUN apt-get update \
|
||||
|
||||
COPY docker/make_config.php /flarum/make_config.php
|
||||
COPY docker/docker-entrypoint.sh /usr/local/bin/docker-entrypoint.sh
|
||||
COPY --from=build /flarum/app /flarum/app
|
||||
RUN chown -R www-data:www-data /flarum
|
||||
RUN chmod a+x /usr/local/bin/docker-entrypoint.sh
|
||||
RUN composer create-project flarum/flarum /flarum/app
|
||||
RUN chown -R www-data:www-data /flarum
|
||||
|
||||
VOLUME /flarum/app/extensions /flarum/app/public/assets /flarum/app/storage/logs
|
||||
ENTRYPOINT ["/usr/local/bin/docker-entrypoint.sh"]
|
||||
|
@ -1,7 +1,8 @@
|
||||
version: '3'
|
||||
services:
|
||||
flarum:
|
||||
image: git.snyman.info/raoul/flarum:latest
|
||||
# image: git.snyman.info/raoul/flarum:latest
|
||||
build: .
|
||||
environment:
|
||||
MYSQL_DATABASE: flarum
|
||||
MYSQL_USER: flarum
|
||||
@ -17,14 +18,15 @@ services:
|
||||
MAIL_ENCRYPTION: ssl
|
||||
MAIL_USERNAME: admin@example.com
|
||||
MAIL_PASSWORD: secret
|
||||
EXTENSIONS: "fof/upload fof/nightmode fof/polls"
|
||||
ports:
|
||||
- "8000:80"
|
||||
- "9000:80"
|
||||
depends_on:
|
||||
- mysql
|
||||
volumes:
|
||||
- "./data/extensions:/flarum/app/extensions"
|
||||
- "./data/assets:/flarum/app/public/assets"
|
||||
- "./data/storage:/flarum/app/storage"
|
||||
- "./data/storage/logs:/flarum/app/storage/logs"
|
||||
mysql:
|
||||
image: mariadb:11
|
||||
environment:
|
||||
|
@ -51,6 +51,26 @@ else
|
||||
touch /flarum/app/public/assets/.installed.lock
|
||||
fi
|
||||
|
||||
# Change into the flarum directory so that we can do a number of tasks
|
||||
cd /flarum/app
|
||||
|
||||
echo "Installing extensions..."
|
||||
if [[ "$EXTENSIONS" != "" ]]; then
|
||||
# install extensions
|
||||
for EXT in $EXTENSIONS; do
|
||||
composer require $EXT:"*"
|
||||
done
|
||||
fi
|
||||
|
||||
# Always run migrate and clear the cache
|
||||
echo "Running any pending migrations and clearing the cache..."
|
||||
php flarum migrate
|
||||
if [[ -d "/flarum/app/storage/cache" ]]; then
|
||||
php flarum cache:clear
|
||||
fi
|
||||
|
||||
chown www-data:www-data -R /flarum/*
|
||||
|
||||
# first arg is `-f` or `--some-option`
|
||||
if [[ "${1#-}" != "$1" ]]; then
|
||||
set -- apache2-foreground "$@"
|
||||
|
Loading…
Reference in New Issue
Block a user