fix(): permission problem

pull/3/head
Hardware 2016-07-17 15:55:22 +02:00
parent 849ee28b60
commit c3f6d010c6
No known key found for this signature in database
GPG Key ID: EC6DF6F90263EDEA
3 changed files with 14 additions and 13 deletions

View File

@ -33,19 +33,18 @@ RUN echo "@testing https://nl.alpinelinux.org/alpine/edge/testing" >> /etc/apk/r
&& curl -s http://getcomposer.org/installer | php \
&& mv /tmp/composer.phar /usr/bin/composer \
&& chmod +x /usr/bin/composer \
&& mkdir -p /flarum /usr/src/flarum \
&& mkdir -p /flarum/app \
&& addgroup -g ${GID} flarum && adduser -h /flarum -s /bin/sh -D -G flarum -u ${UID} flarum \
&& chown flarum:flarum /flarum /usr/src/flarum \
&& su-exec flarum:flarum composer create-project flarum/flarum /usr/src/flarum $VERSION --stability=beta \
&& chown -R flarum:flarum /flarum \
&& su-exec flarum:flarum composer create-project flarum/flarum /flarum/app $VERSION --stability=beta \
&& composer clear-cache
COPY config.sql /usr/src/flarum/config.sql
COPY config.sql /flarum/app/config.sql
COPY nginx.conf /etc/nginx/nginx.conf
COPY php-fpm.conf /etc/php7/php-fpm.conf
COPY supervisord.conf /etc/supervisor/supervisord.conf
COPY startup /usr/local/bin/startup
RUN chmod +x /usr/local/bin/startup
VOLUME /flarum
EXPOSE 8080
CMD ["/usr/bin/tini","--","startup"]

View File

@ -48,7 +48,7 @@ http {
server {
listen 8080;
root /flarum;
root /flarum/app;
index index.php;
access_log /var/log/nginx/access.log;

16
startup
View File

@ -10,9 +10,11 @@ if [ -z "$FORUM_URL" ]; then
exit 1
fi
if [ ! -e '/flarum/config.php' ]; then
if [ ! -e '/flarum/app/config.php' ]; then
cat > /usr/src/flarum/config.yml <<EOF
cd /flarum/app/
cat > config.yml <<EOF
databaseConfiguration:
driver: mysql
host: ${DB_HOST}
@ -29,20 +31,20 @@ sed -i -e "s|{{ MAIL_FROM }}|${MAIL_FROM}|g" \
-e "s|{{ MAIL_PORT }}|${MAIL_PORT}|g" \
-e "s|{{ MAIL_USER }}|${MAIL_USER}|g" \
-e "s|{{ MAIL_PASS }}|${MAIL_PASS}|g" \
-e "s|{{ MAIL_ENCR }}|${MAIL_ENCR}|g" /usr/src/flarum/config.sql
-e "s|{{ MAIL_ENCR }}|${MAIL_ENCR}|g" config.sql
# Fix installer, wait fix in beta 6
# PHP Fatal error: Uncaught ReflectionException: Class flarum.config does not
# exist in /flarum/vendor/illuminate/container/Container.php
# https://github.com/flarum/core/commit/7192c4391bee006ccc2de3db6caa89803d72d130
sed -i -e 's|InfoCommand::class,||g' \
-e "s|\['config' => \$app->make('flarum.config')\]|['config' => \$app->isInstalled() ? \$app->make('flarum.config') : []]|g" /usr/src/flarum/vendor/flarum/core/src/Console/Server.php
-e "s|\['config' => \$app->make('flarum.config')\]|['config' => \$app->isInstalled() ? \$app->make('flarum.config') : []]|g" vendor/flarum/core/src/Console/Server.php
# Copy flarum src to final dir
mv /usr/src/flarum/* /flarum && cd /flarum
# Set permissions
chown -R flarum:flarum /flarum
# Install flarum (migrate database + assets)
php flarum install --file config.yml
su-exec flarum:flarum php flarum install --file config.yml
# Define flarum settings in database
mysql -h"${DB_HOST}" -u"${DB_USER}" -p"${DB_PASS}" "${DB_NAME}" < config.sql