no more pointless txt files for version

This commit is contained in:
Andrew Dolgov 2023-04-10 19:53:49 +03:00
parent 8ccea1712e
commit 2420feb91f
No known key found for this signature in database
GPG Key ID: 1A56B4FA25D4AF2A
2 changed files with 19 additions and 15 deletions

View File

@ -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

View File

@ -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") {