From c5310da92a482d608000dc4d4848dad1aaf817cc Mon Sep 17 00:00:00 2001 From: Magicalex Date: Wed, 27 Nov 2019 03:42:51 +0100 Subject: [PATCH] feat(): update Dockerfile --- .editorconfig | 5 +- Dockerfile | 49 +++++-------------- README.md | 5 ++ .../app/{config.php => config.php.sample} | 0 rootfs/services/.s6-svscan/finish | 2 +- rootfs/services/nginx/run | 2 +- rootfs/services/php/run | 2 +- rootfs/usr/local/bin/extension | 2 +- rootfs/usr/local/bin/run.sh | 9 ++-- 9 files changed, 27 insertions(+), 49 deletions(-) rename rootfs/flarum/app/{config.php => config.php.sample} (100%) diff --git a/.editorconfig b/.editorconfig index 87694dd..47c34b5 100644 --- a/.editorconfig +++ b/.editorconfig @@ -12,8 +12,5 @@ insert_final_newline = true indent_style = space indent_size = 2 -[*.{diff,md}] +[*.md] trim_trailing_whitespace = false - -[*.php] -indent_size = 4 diff --git a/Dockerfile b/Dockerfile index 0e3cee0..89da876 100644 --- a/Dockerfile +++ b/Dockerfile @@ -11,43 +11,18 @@ ENV GID=991 \ PHP_MEMORY_LIMIT=128M \ OPCACHE_MEMORY_LIMIT=128 -RUN echo "@community http://dl-cdn.alpinelinux.org/alpine/v3.10/community" >> /etc/apk/repositories \ - && apk add -U \ - nginx \ - s6 \ - su-exec \ - curl \ - git \ - php7@community \ - php7-fileinfo@community \ - php7-phar@community \ - php7-fpm@community \ - php7-curl@community \ - php7-mbstring@community \ - php7-openssl@community \ - php7-json@community \ - php7-pdo@community \ - php7-pdo_mysql@community \ - php7-mysqlnd@community \ - php7-zlib@community \ - php7-gd@community \ - php7-dom@community \ - php7-ctype@community \ - php7-session@community \ - php7-opcache@community \ - php7-xmlwriter@community \ - php7-tokenizer@community \ - php7-zip@community \ - php7-intl@community \ - && cd /tmp \ - && curl -s http://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer \ - && chmod +x /usr/local/bin/composer \ - && composer global require hirak/prestissimo \ - && mkdir -p /flarum/app \ - && chown -R $UID:$GID /flarum \ - && COMPOSER_CACHE_DIR="/tmp" su-exec $UID:$GID composer create-project flarum/flarum /flarum/app $VERSION --stability=beta \ - && composer clear-cache \ - && rm -rf /flarum/.composer /var/cache/apk/* +RUN apk add --update-cache nginx s6 su-exec curl git php7 php7-fileinfo php7-phar php7-fpm php7-curl \ + php7-mbstring php7-openssl php7-json php7-pdo php7-pdo_mysql php7-mysqlnd php7-zlib php7-gd php7-dom \ + php7-ctype php7-session php7-opcache php7-xmlwriter php7-tokenizer php7-zip php7-intl \ + && cd /tmp \ + && curl -s http://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer \ + && chmod +x /usr/local/bin/composer \ + && composer global require --no-progress --no-suggest -- hirak/prestissimo \ + && mkdir -p /flarum/app \ + && chown -R $UID:$GID /flarum \ + && COMPOSER_CACHE_DIR="/tmp" su-exec $UID:$GID composer create-project --stability=beta --no-progress -- flarum/flarum /flarum/app $VERSION \ + && composer clear-cache \ + && rm -rf /flarum/.composer /var/cache/apk/* COPY rootfs / RUN chmod +x /usr/local/bin/* /services/*/run /services/.s6-svscan/* diff --git a/README.md b/README.md index 758d36e..0d8154e 100644 --- a/README.md +++ b/README.md @@ -2,6 +2,11 @@ ![logo](https://i.imgur.com/Bjrtbsc.png "logo") +[![](https://img.shields.io/docker/cloud/build/mondedie/docker-flarum)](https://hub.docker.com/r/mondedie/docker-flarum/builds) +[![](https://img.shields.io/docker/cloud/automated/mondedie/docker-flarum)](https://hub.docker.com/r/mondedie/docker-flarum/builds) +[![](https://img.shields.io/docker/pulls/mondedie/docker-flarum)](https://hub.docker.com/r/mondedie/docker-flarum) +[![](https://img.shields.io/docker/stars/mondedie/docker-flarum)](https://hub.docker.com/r/mondedie/docker-flarum) + ### What is this ? Simple forum software for building great communities. https://flarum.org/ diff --git a/rootfs/flarum/app/config.php b/rootfs/flarum/app/config.php.sample similarity index 100% rename from rootfs/flarum/app/config.php rename to rootfs/flarum/app/config.php.sample diff --git a/rootfs/services/.s6-svscan/finish b/rootfs/services/.s6-svscan/finish index 039e4d0..ec5b9e5 100644 --- a/rootfs/services/.s6-svscan/finish +++ b/rootfs/services/.s6-svscan/finish @@ -1,2 +1,2 @@ -#!/bin/sh +#!/usr/bin/env sh exit 0 diff --git a/rootfs/services/nginx/run b/rootfs/services/nginx/run index eaf8049..0c5d17a 100644 --- a/rootfs/services/nginx/run +++ b/rootfs/services/nginx/run @@ -1,2 +1,2 @@ -#!/bin/sh +#!/usr/bin/env sh exec nginx diff --git a/rootfs/services/php/run b/rootfs/services/php/run index e238021..e59a2b3 100644 --- a/rootfs/services/php/run +++ b/rootfs/services/php/run @@ -1,2 +1,2 @@ -#!/bin/sh +#!/usr/bin/env sh exec php-fpm7 diff --git a/rootfs/usr/local/bin/extension b/rootfs/usr/local/bin/extension index 02de690..6ca8d2c 100644 --- a/rootfs/usr/local/bin/extension +++ b/rootfs/usr/local/bin/extension @@ -1,4 +1,4 @@ -#!/bin/sh +#!/usr/bin/env sh # COMPOSER WRAPUP SCRIPT # This script allow to add new extensions to flarum diff --git a/rootfs/usr/local/bin/run.sh b/rootfs/usr/local/bin/run.sh index 42f5c3b..64bf382 100644 --- a/rootfs/usr/local/bin/run.sh +++ b/rootfs/usr/local/bin/run.sh @@ -1,4 +1,4 @@ -#!/bin/sh +#!/usr/bin/env sh # Default values DB_HOST="${DB_HOST:-mariadb}" @@ -64,7 +64,7 @@ if [ ! -e '/etc/nginx/conf.d/custom-vhost-flarum.conf' ]; then # }' > /etc/nginx/conf.d/custom-vhost-flarum.conf fi -# if no installation was performed before +# if installation was performed before if [ -e '/flarum/app/public/assets/rev-manifest.json' ]; then echo "[INFO] Flarum already installed, init app..." @@ -74,8 +74,9 @@ if [ -e '/flarum/app/public/assets/rev-manifest.json' ]; then -e "s||${DB_USER}|g" \ -e "s||${DB_PASS}|g" \ -e "s||${DB_PREF}|g" \ - -e "s||${FORUM_URL}|g" /flarum/app/config.php + -e "s||${FORUM_URL}|g" /flarum/app/config.php.sample + cp /flarum/app/config.php.sample /flarum/app/config.php su-exec $UID:$GID php /flarum/app/flarum cache:clear # Composer cache dir and packages list paths @@ -97,8 +98,8 @@ if [ -e '/flarum/app/public/assets/rev-manifest.json' ]; then echo "[INFO] Init done, launch flarum..." else + # if no installation was performed before echo "[INFO] First launch, installation..." - rm -rf /flarum/app/config.php if [ -z "${FLARUM_ADMIN_USER}" ] || [ -z "${FLARUM_ADMIN_PASS}" ] || [ -z "${FLARUM_ADMIN_MAIL}" ]; then echo "[ERROR] User admin info of flarum must be set !"