diff --git a/.docker/app/Dockerfile b/.docker/app/Dockerfile index 7dad293c1..b9fee0dec 100644 --- a/.docker/app/Dockerfile +++ b/.docker/app/Dockerfile @@ -4,12 +4,6 @@ EXPOSE 9000/tcp ENV SCRIPT_ROOT=/opt/tt-rss ENV SRC_DIR=/src/tt-rss/ -ARG BUILD_TIMESTAMP -ARG CI_COMMIT_BRANCH -ARG CI_COMMIT_SHORT_SHA -ARG CI_COMMIT_TIMESTAMP -ARG CI_COMMIT_SHA - RUN apk add --no-cache dcron php81 php81-fpm php81-phar php81-sockets \ php81-pdo php81-gd php81-pgsql php81-pdo_pgsql php81-xmlwriter \ php81-mbstring php81-intl php81-xml php81-curl php81-simplexml \ @@ -25,6 +19,21 @@ RUN apk add --no-cache dcron php81 php81-fpm php81-phar php81-sockets \ /etc/php81/php-fpm.d/www.conf && \ mkdir -p /var/www ${SCRIPT_ROOT}/config.d +ARG BUILD_TIMESTAMP +ENV BUILD_TIMESTAMP=${BUILD_TIMESTAMP} + +ARG CI_COMMIT_BRANCH +ENV CI_COMMIT_BRANCH=${CI_COMMIT_BRANCH} + +ARG CI_COMMIT_SHORT_SHA +ENV CI_COMMIT_SHORT_SHA=${CI_COMMIT_SHORT_SHA} + +ARG CI_COMMIT_TIMESTAMP +ENV CI_COMMIT_TIMESTAMP=${CI_COMMIT_TIMESTAMP} + +ARG CI_COMMIT_SHA +ENV CI_COMMIT_SHA=${CI_COMMIT_SHA} + ADD --chmod=0755 startup.sh ${SCRIPT_ROOT} ADD --chmod=0755 updater.sh ${SCRIPT_ROOT} ADD --chmod=0755 dcron.sh ${SCRIPT_ROOT} @@ -35,10 +44,6 @@ ADD config.docker.php ${SCRIPT_ROOT} COPY --from=app-src . ${SRC_DIR} -RUN [ ! -z ${BUILD_TIMESTAMP} ] \ - && echo ${BUILD_TIMESTAMP}-${CI_COMMIT_BRANCH}-${CI_COMMIT_SHORT_SHA} ${CI_COMMIT_TIMESTAMP} ${CI_COMMIT_SHA} | \ - tee ${SRC_DIR}/version_static_official.txt - ARG ORIGIN_REPO_XACCEL=https://git.tt-rss.org/fox/ttrss-nginx-xaccel.git RUN git clone --depth=1 ${ORIGIN_REPO_XACCEL} ${SRC_DIR}/plugins.local/nginx_xaccel diff --git a/classes/config.php b/classes/config.php index 48bbc2258..8e202274f 100644 --- a/classes/config.php +++ b/classes/config.php @@ -323,12 +323,11 @@ class Config { if (empty($this->version)) { $this->version["status"] = -1; - if (file_exists("$root_dir/version_static_official.txt")) { - list ($version, $timestamp, $commit) = explode(" ", file_get_contents("$root_dir/version_static_official.txt")); + if (getenv("BUILD_TIMESTAMP") && getenv("CI_COMMIT_SHORT_SHA")) { - $this->version["version"] = trim($version); - $this->version["timestamp"] = strtotime(trim($timestamp)); - $this->version["commit"] = trim($commit); + $this->version["version"] = sprintf("%s-%s-%s", getenv("BUILD_TIMESTAMP"), getenv("CI_COMMIT_BRANCH"), getenv("CI_COMMIT_SHORT_SHA")); + $this->version["timestamp"] = strtotime(getenv("CI_COMMIT_TIMESTAMP")); + $this->version["commit"] = getenv("CI_COMMIT_SHA"); $this->version["status"] = 0; } else if (PHP_OS === "Darwin") {