diff --git a/Dockerfile b/Dockerfile index 49ca630..6a86faa 100644 --- a/Dockerfile +++ b/Dockerfile @@ -8,8 +8,12 @@ LABEL org.opencontainers.image.source="https://gitea.rknet.org/docker/freshrss" LABEL org.opencontainers.image.documentation="https://gitea.rknet.org/docker/freshrss" ARG BUILD_VERSION +ARG CONTAINER_LIBRARY + # renovate: datasource=github-releases depName=FreshRSS/FreshRSS ENV FRESHRSS_VERSION="${BUILD_VERSION:-1.18.1}" +# renovate: datasource=git-tags depName=https://gitea.rknet.org/docker/container-library +ENV CONTAINER_LIBRARY="${CONTAINER_LIBRARY:-v0.1.3}" ADD overlay/ / @@ -18,6 +22,8 @@ RUN apk --update add --virtual .build-deps tar curl && \ php7-zip php7-ctype php7-dom php7-fileinfo php7-iconv php7-json php7-session \ php7-simplexml php7-xmlreader php7-zlib php7-pdo_sqlite php7-pdo_mysql\ php7-pdo_pgsql && \ + curl -SsL "https://gitea.rknet.org/docker/container-library/releases/download/${CONTAINER_LIBRARY}/container-library.tar.gz" | \ + tar xz -C / && \ rm -rf /var/www/localhost && \ rm -f /etc/php7/php-fpm.d/www.conf && \ mkdir -p /var/www/app && \ diff --git a/overlay/usr/local/bin/entrypoint b/overlay/usr/local/bin/entrypoint index 734523d..54f78d7 100755 --- a/overlay/usr/local/bin/entrypoint +++ b/overlay/usr/local/bin/entrypoint @@ -1,5 +1,8 @@ #!/usr/bin/env sh +# shellcheck disable=SC1091 +. /usr/local/lib/log.sh + /usr/local/bin/gomplate -o /etc/php7/php.ini -f /etc/templates/php.ini.tmpl /usr/local/bin/gomplate -o /var/www/app/data/config.php -f /etc/templates/config.php.tmpl /usr/local/bin/gomplate -o /var/www/app/constants.local.php -f /etc/templates/constants.local.php.tmpl @@ -8,46 +11,52 @@ if [ -n "${FRESHRSS_POSTGRES_SSL_ROOTCERT}" ] && [ ! -f "/var/www/.postgresql/ro ln -s "${FRESHRSS_POSTGRES_SSL_ROOTCERT}" /var/www/.postgresql/root.crt fi -printf "\nPrepare FreshRSS...\n" +log_info "Prepare FreshRSS" /usr/bin/php -f ./cli/prepare.php >/dev/null 2>&1 -/usr/bin/php -f ./cli/do-install.php -- --api_enabled \ +ERROR=$(/usr/bin/php -f ./cli/do-install.php -- --api_enabled \ --base_url "${FRESHRSS_BASE_URL:-http://localhost/}" \ --db-base "${FRESHRSS_DB_BASE}" \ --db-host "${FRESHRSS_DB_HOST:-localhost}" \ --db-password "${FRESHRSS_DB_PASSWORD}" \ --db-type "${FRESHRSS_DB_TYPE:-sqlite}" \ --db-user "${FRESHRSS_DB_USER}" \ - --default_user "${FRESHRSS_DEFAULT_USER:-_}" \ - --language "${FRESHRSS_LANGUAGE:-en}" >/dev/null 2>&1 + --default_user "${FRESHRSS_DEFAULT_USER:-admin}" \ + --language "${FRESHRSS_LANGUAGE:-en}" \ + 2>&1) EXITCODE=$? if [ $EXITCODE -eq 3 ]; then - printf 'FreshRSS already installed, no change performed\n' + log_info "FreshRSS already installed, skipped" elif [ $EXITCODE -eq 0 ]; then - printf 'FreshRSS successfully installed\n' + log_info "FreshRSS successfully installed" else - printf 'FreshRSS error during installation\n' + log_error "FreshRSS error during installation: ${ERROR}" exit $EXITCODE fi if [ "${FRESHRSS_DEFAULT_USER}" ]; then - printf "\nEnsure default user exists...\n" - /usr/bin/php ./cli/create-user.php --user "$FRESHRSS_DEFAULT_USER" --password "$FRESHRSS_DEFAULT_PASSWORD" --language "${FRESHRSS_LANGUAGE:-en}" >/dev/null 2>&1 + log_info "Ensure default user exists" + ERROR=$(/usr/bin/php ./cli/create-user.php \ + --user "$FRESHRSS_DEFAULT_USER" \ + --password "$FRESHRSS_DEFAULT_PASSWORD" \ + --language "${FRESHRSS_LANGUAGE:-en}" \ + 2>&1) EXITCODE=$? if [ $EXITCODE -eq 3 ]; then - printf 'FreshRSS user already exists, no change performed\n' + log_info "FreshRSS user already exists, skipped" elif [ $EXITCODE -eq 0 ]; then - printf 'FreshRSS user successfully created\n' + log_info "FreshRSS user successfully created" ./cli/list-users.php | xargs -n1 ./cli/actualize-user.php --user "$FRESHRSS_DEFAULT_USER" else rm -f /tmp/out.txt /tmp/err.txt - printf 'FreshRSS error during the creation of a user\n' + log_error "FreshRSS error during the creation of a user: ${ERROR}" exit $EXITCODE fi fi +log_info "Start FreshRSS Server\n" supercronic /etc/crontabs/nginx & php-fpm7 -F & exec nginx -g "daemon off;"