From c3f6d010c6e592d0d3a01beb9251956ab72f9e2d Mon Sep 17 00:00:00 2001 From: Hardware Date: Sun, 17 Jul 2016 15:55:22 +0200 Subject: [PATCH] fix(): permission problem --- Dockerfile | 9 ++++----- nginx.conf | 2 +- startup | 16 +++++++++------- 3 files changed, 14 insertions(+), 13 deletions(-) diff --git a/Dockerfile b/Dockerfile index 75e0e99..b217b21 100644 --- a/Dockerfile +++ b/Dockerfile @@ -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"] diff --git a/nginx.conf b/nginx.conf index e5ce4fe..ab9b74e 100644 --- a/nginx.conf +++ b/nginx.conf @@ -48,7 +48,7 @@ http { server { listen 8080; - root /flarum; + root /flarum/app; index index.php; access_log /var/log/nginx/access.log; diff --git a/startup b/startup index 9d845e0..995f031 100644 --- a/startup +++ b/startup @@ -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 < config.yml < \$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